publish 2.0.16

This commit is contained in:
jonyshi 2019-04-26 18:10:57 +08:00
parent 81bf1a24d1
commit f1420c0c6a
9 changed files with 261 additions and 183 deletions

View File

@ -310,7 +310,7 @@
.u-table-filter-column-pop-cont { .u-table-filter-column-pop-cont {
margin: 0px; margin: 0px;
max-height: 300px; max-height: 300px;
overflow-y: scroll; overflow-y: auto;
color: #212121; } color: #212121; }
.u-table-filter-column-clear-setting { .u-table-filter-column-clear-setting {
cursor: pointer; cursor: pointer;
@ -384,6 +384,11 @@
display: none; } display: none; }
.u-table ::-webkit-scrollbar-track-piece { .u-table ::-webkit-scrollbar-track-piece {
display: none; } display: none; }
.u-table .row-dragg-able {
cursor: move; }
.u-table .u-table-drag-hidden-cont {
width: 100px;
height: 40px; }
.u-table:focus { .u-table:focus {
outline: none; outline: none;
@ -617,3 +622,21 @@
.u-table-drag-hidden-cont { .u-table-drag-hidden-cont {
position: absolute; position: absolute;
top: -1000px; } 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; }

View File

@ -173,14 +173,33 @@ var Table = function (_Component) {
}); });
}; };
_this.onDragRow = function (currentIndex, targetIndex) { _this.getTableUID = function () {
var data = _this.state.data, var uid = "_table_uid_" + new Date().getTime();
currentObj = data[currentIndex], _this.tableUid = uid;
targetObj = data[targetIndex]; 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); _this.onDragRow = function (currentKey, targetKey) {
data.splice(targetIndex, 0, data.splice(currentIndex, 1).shift()); var data = _this.state.data,
console.log(" _data---- ", 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({ _this.setState({
data: data data: data
}); });
@ -283,10 +302,12 @@ var Table = function (_Component) {
_this.handleRowHover = _this.handleRowHover.bind(_this); _this.handleRowHover = _this.handleRowHover.bind(_this);
_this.computeTableWidth = _this.computeTableWidth.bind(_this); _this.computeTableWidth = _this.computeTableWidth.bind(_this);
_this.onBodyMouseLeave = _this.onBodyMouseLeave.bind(_this); _this.onBodyMouseLeave = _this.onBodyMouseLeave.bind(_this);
_this.tableUid = null;
return _this; return _this;
} }
Table.prototype.componentDidMount = function componentDidMount() { Table.prototype.componentDidMount = function componentDidMount() {
this.getTableUID();
_utils.EventUtil.addHandler(this.contentTable, 'keydown', this.onKeyDown); _utils.EventUtil.addHandler(this.contentTable, 'keydown', this.onKeyDown);
_utils.EventUtil.addHandler(this.contentTable, 'focus', this.onFocus); _utils.EventUtil.addHandler(this.contentTable, 'focus', this.onFocus);
setTimeout(this.resetScrollX, 300); setTimeout(this.resetScrollX, 300);
@ -786,7 +807,7 @@ var Table = function (_Component) {
indent: indent, indent: indent,
indentSize: props.indentSize, indentSize: props.indentSize,
needIndentSpaced: needIndentSpaced, needIndentSpaced: needIndentSpaced,
className: className, className: className + ' ' + (this.props.rowDraggAble ? ' row-dragg-able ' : ''),
record: record, record: record,
expandIconAsCell: expandIconAsCell, expandIconAsCell: expandIconAsCell,
onDestroy: this.onRowDestroy, onDestroy: this.onRowDestroy,
@ -820,7 +841,8 @@ var Table = function (_Component) {
bodyDisplayInRow: props.bodyDisplayInRow, bodyDisplayInRow: props.bodyDisplayInRow,
rowDraggAble: this.props.rowDraggAble, rowDraggAble: this.props.rowDraggAble,
onDragRow: this.onDragRow, onDragRow: this.onDragRow,
contentTable: this.contentTable contentTable: this.contentTable,
tableUid: this.tableUid
}))); })));
this.treeRowIndex++; this.treeRowIndex++;
var subVisible = visible && isRowExpanded; var subVisible = visible && isRowExpanded;

View File

@ -102,6 +102,11 @@ var TableRow = function (_Component) {
target = _utils.Event.getTarget(event); target = _utils.Event.getTarget(event);
_this.currentIndex = target.getAttribute("data-row-key"); _this.currentIndex = target.getAttribute("data-row-key");
_this._dragCurrent = target; _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.effectAllowed = "move";
event.dataTransfer.setData("Text", _this.currentIndex); event.dataTransfer.setData("Text", _this.currentIndex);
}; };
@ -119,15 +124,37 @@ var TableRow = function (_Component) {
var event = _utils.Event.getEvent(e), var event = _utils.Event.getEvent(e),
_target = _utils.Event.getTarget(event), _target = _utils.Event.getTarget(event),
target = _target.parentNode; 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") { if (target.nodeName.toUpperCase() === "TR") {
_this.synchronizeTableTr(_this.currentIndex, null); _this.synchronizeTableTr(currentKey, null);
_this.synchronizeTableTr(targetKey, null);
// target.setAttribute("style",""); // target.setAttribute("style","");
// this.synchronizeTrStyle(this.currentIndex,false); // this.synchronizeTrStyle(this.currentIndex,false);
} }
var _currentIndex = event.dataTransfer.getData("text"); onDragRow && onDragRow(currentKey, targetKey);
onDragRow && onDragRow(parseInt(_this.currentIndex--), parseInt(currentIndex--)); };
_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) { _this.synchronizeTableTr = function (currentIndex, type) {
@ -274,6 +301,12 @@ var TableRow = function (_Component) {
*/ */
/**
*同步当前拖拽到阴影
* @memberof TableRow
*/
/** /**
* 同步自己,也需要同步当前行的行显示 * 同步自己,也需要同步当前行的行显示
*/ */

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

@ -1,97 +1,97 @@
{ {
"name": "bee-table", "name": "bee-table",
"version": "2.0.15", "version": "2.0.16",
"description": "Table ui component for react", "description": "Table ui component for react",
"keywords": [ "keywords": [
"react", "react",
"react-component", "react-component",
"bee-table", "bee-table",
"iuap-design", "iuap-design",
"tinper-bee", "tinper-bee",
"Table" "Table"
],
"engines": {
"node": ">=6.0.0"
},
"jest": {
"moduleFileExtensions": [
"js",
"jsx"
], ],
"engines": { "transform": {
"node": ">=6.0.0" "^.+\\.js$": "babel-jest"
},
"jest": {
"moduleFileExtensions": [
"js",
"jsx"
],
"transform": {
"^.+\\.js$": "babel-jest"
}
},
"homepage": "https://github.com/tinper-bee/bee-table.git",
"author": "Yonyou FED",
"repository": "http://github.com/tinper-bee/bee-table",
"bugs": "https://github.com/tinper-bee/bee-table.git/issues",
"license": "MIT",
"main": "./build/index.js",
"config": {
"port": 3000,
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
}
},
"scripts": {
"dev": "bee-tools run start",
"build": "bee-tools run build",
"lint": "bee-tools run lint",
"test": "jest",
"chrome": "bee-tools run chrome",
"coveralls": "jest",
"browsers": "bee-tools run browsers",
"pub": "bee-tools run pub",
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0"
},
"dependencies": {
"bee-button": "latest",
"bee-checkbox": "latest",
"bee-datepicker": "^2.0.28",
"bee-dropdown": "^2.0.4",
"bee-form-control": "latest",
"bee-icon": "latest",
"bee-input-number": "^2.0.7",
"bee-loading": "^1.0.9",
"bee-locale": "0.0.13",
"bee-menus": "^2.0.6",
"bee-radio": "^2.0.8",
"bee-select": "^2.0.11",
"classnames": "^2.2.5",
"component-classes": "^1.2.6",
"lodash.clonedeep": "^4.5.0",
"object-path": "^0.11.3",
"ref-tree": "^2.0.1-beta.1",
"shallowequal": "^1.0.2",
"throttle-debounce": "^2.0.1",
"tinper-bee-core": "latest",
"warning": "^3.0.0"
},
"peerDependencies": {
"react": "^15.3.0 || ^16.0",
"react-dom": "^15.3.0 || ^16.0",
"prop-types": "^15.6.0"
},
"devDependencies": {
"babel-jest": "^22.0.4",
"bee-clipboard": "^2.0.0",
"bee-drawer": "0.0.2",
"bee-layout": "latest",
"bee-pagination": "^2.0.5",
"bee-panel": "latest",
"bee-popover": "^2.0.0",
"chai": "^3.5.0",
"console-polyfill": "~0.2.1",
"cz-conventional-changelog": "^2.1.0",
"enzyme": "^2.9.1",
"es5-shim": "~4.1.10",
"jest": "^22.0.4",
"react": "^16.6.3",
"react-addons-test-utils": "^15.5.0",
"react-dom": "^16.6.3",
"ref-tree": "^2.0.1-beta.1",
"reqwest": "^2.0.5",
"tinper-bee": "latest"
} }
},
"homepage": "https://github.com/tinper-bee/bee-table.git",
"author": "Yonyou FED",
"repository": "http://github.com/tinper-bee/bee-table",
"bugs": "https://github.com/tinper-bee/bee-table.git/issues",
"license": "MIT",
"main": "./build/index.js",
"config": {
"port": 3000,
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
}
},
"scripts": {
"dev": "bee-tools run start",
"build": "bee-tools run build",
"lint": "bee-tools run lint",
"test": "jest",
"chrome": "bee-tools run chrome",
"coveralls": "jest",
"browsers": "bee-tools run browsers",
"pub": "bee-tools run pub",
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0"
},
"dependencies": {
"bee-button": "latest",
"bee-checkbox": "latest",
"bee-datepicker": "^2.0.28",
"bee-dropdown": "^2.0.4",
"bee-form-control": "latest",
"bee-icon": "latest",
"bee-input-number": "^2.0.7",
"bee-loading": "^1.0.9",
"bee-locale": "0.0.13",
"bee-menus": "^2.0.6",
"bee-radio": "^2.0.8",
"bee-select": "^2.0.11",
"classnames": "^2.2.5",
"component-classes": "^1.2.6",
"lodash.clonedeep": "^4.5.0",
"object-path": "^0.11.3",
"ref-tree": "^2.0.1-beta.1",
"shallowequal": "^1.0.2",
"throttle-debounce": "^2.0.1",
"tinper-bee-core": "latest",
"warning": "^3.0.0"
},
"peerDependencies": {
"react": "^15.3.0 || ^16.0",
"react-dom": "^15.3.0 || ^16.0",
"prop-types": "^15.6.0"
},
"devDependencies": {
"babel-jest": "^22.0.4",
"bee-clipboard": "^2.0.0",
"bee-drawer": "0.0.2",
"bee-layout": "latest",
"bee-pagination": "^2.0.5",
"bee-panel": "latest",
"bee-popover": "^2.0.0",
"chai": "^3.5.0",
"console-polyfill": "~0.2.1",
"cz-conventional-changelog": "^2.1.0",
"enzyme": "^2.9.1",
"es5-shim": "~4.1.10",
"jest": "^22.0.4",
"react": "^16.6.3",
"react-addons-test-utils": "^15.5.0",
"react-dom": "^16.6.3",
"ref-tree": "^2.0.1-beta.1",
"reqwest": "^2.0.5",
"tinper-bee": "latest"
}
} }