UNPKG

24.3 kBJavaScriptView Raw
1'use strict';
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6
7var _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; };
8
9var _react = require('react');
10
11var _react2 = _interopRequireDefault(_react);
12
13var _propTypes = require('prop-types');
14
15var _propTypes2 = _interopRequireDefault(_propTypes);
16
17var _utils = require('./lib/utils');
18
19var _TableCell = require('./TableCell');
20
21var _TableCell2 = _interopRequireDefault(_TableCell);
22
23var _ExpandIcon = require('./ExpandIcon');
24
25var _ExpandIcon2 = _interopRequireDefault(_ExpandIcon);
26
27function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
28
29function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
30
31function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
32
33function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
34
35function _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); }
36
37var propTypes = {
38 onDestroy: _propTypes2["default"].func,
39 onRowClick: _propTypes2["default"].func,
40 onRowDoubleClick: _propTypes2["default"].func,
41 record: _propTypes2["default"].object,
42 clsPrefix: _propTypes2["default"].string,
43 expandIconColumnIndex: _propTypes2["default"].number,
44 onHover: _propTypes2["default"].func,
45 columns: _propTypes2["default"].array,
46 height: _propTypes2["default"].oneOfType([_propTypes2["default"].string, _propTypes2["default"].number]),
47 visible: _propTypes2["default"].bool,
48 index: _propTypes2["default"].number,
49 hoverKey: _propTypes2["default"].any,
50 expanded: _propTypes2["default"].bool,
51 expandable: _propTypes2["default"].any,
52 onExpand: _propTypes2["default"].func,
53 needIndentSpaced: _propTypes2["default"].bool,
54 className: _propTypes2["default"].string,
55 indent: _propTypes2["default"].number,
56 indentSize: _propTypes2["default"].number,
57 expandIconAsCell: _propTypes2["default"].bool,
58 expandRowByClick: _propTypes2["default"].bool,
59 store: _propTypes2["default"].object.isRequired,
60 rowDraggAble: _propTypes2["default"].bool,
61 onDragRow: _propTypes2["default"].func,
62 onDragRowStart: _propTypes2["default"].func,
63 syncRowHeight: _propTypes2["default"].bool
64};
65
66var defaultProps = {
67 onRowClick: function onRowClick() {},
68
69 // onRowDoubleClick() {},
70 onDestroy: function onDestroy() {},
71
72 expandIconColumnIndex: 0,
73 expandRowByClick: false,
74 onHover: function onHover() {},
75
76 className: '',
77 setRowParentIndex: function setRowParentIndex() {},
78 rowDraggAble: false,
79 // onDragRow:()=>{}
80 syncRowHeight: false
81};
82
83var TableRow = function (_Component) {
84 _inherits(TableRow, _Component);
85
86 function TableRow(props) {
87 _classCallCheck(this, TableRow);
88
89 var _this = _possibleConstructorReturn(this, _Component.call(this, props));
90
91 _this.initEvent = function () {
92 var events = [{ key: 'touchstart', fun: _this.onTouchStart }, //手指触摸到一个 DOM 元素时触发
93 { key: 'touchmove', fun: _this.onTouchMove }, //手指在一个 DOM 元素上滑动时触发
94 { key: 'touchend', fun: _this.onTouchEnd }, //手指从一个 DOM 元素上移开时触发
95
96 { key: 'dragstart', fun: _this.onDragStart }, //用户开始拖动元素时触发
97 { key: 'dragover', fun: _this.onDragOver }, //当某被拖动的对象在另一对象容器范围内拖动时触发此事件
98 { key: 'drop', fun: _this.onDrop }, //在一个拖动过程中,释放鼠标键时触发此事件
99 { key: 'dragenter', fun: _this.onDragEnter }, { key: 'dragleave', fun: _this.onDragLeave }];
100 _this.eventListen(events, '', _this.element);
101 };
102
103 _this.removeDragAbleEvent = function () {
104 var events = [{ key: 'touchstart', fun: _this.onTouchStart }, //手指触摸到一个 DOM 元素时触发
105 { key: 'touchmove', fun: _this.onTouchMove }, //手指在一个 DOM 元素上滑动时触发
106 { key: 'touchend', fun: _this.onTouchEnd }, //手指从一个 DOM 元素上移开时触发
107
108 { key: 'dragstart', fun: _this.onDragStart }, //用户开始拖动元素时触发
109 { key: 'dragover', fun: _this.onDragOver }, //当某被拖动的对象在另一对象容器范围内拖动时触发此事件
110 { key: 'drop', fun: _this.onDrop }, //在一个拖动过程中,释放鼠标键时触发此事件
111 { key: 'dragenter', fun: _this.onDragEnter }, { key: 'dragleave', fun: _this.onDragLeave }];
112 _this.eventListen(events, 'remove', _this.element);
113 };
114
115 _this.onDragStart = function (e) {
116 var onDragRowStart = _this.props.onDragRowStart;
117
118 if (!_this.props.rowDraggAble || _this.notRowDrag) return;
119 var event = _utils.Event.getEvent(e),
120 target = _utils.Event.getTarget(event);
121 if (target.tagName === 'TD') {
122 target = target.parentNode;
123 }
124 _this.currentIndex = target.getAttribute("data-row-key");
125 _this._dragCurrent = target;
126 event.dataTransfer.effectAllowed = "move";
127 event.dataTransfer.setData("Text", _this.currentIndex);
128 onDragRowStart && onDragRowStart(_this.currentIndex);
129 };
130
131 _this.onDragOver = function (e) {
132 var event = _utils.Event.getEvent(e);
133 event.preventDefault();
134 };
135
136 _this.onDrop = function (e) {
137 var onDragRow = _this.props.onDragRow;
138
139 var event = _utils.Event.getEvent(e),
140 _target = _utils.Event.getTarget(event),
141 target = _target.parentNode;
142 event.preventDefault();
143 event.stopPropagation();
144 var currentKey = event.dataTransfer.getData("text");
145 var targetKey = target.getAttribute("data-row-key");
146
147 if (!targetKey || targetKey === currentKey) return;
148 if (target.nodeName.toUpperCase() === "TR") {
149 _this.synchronizeTableTr(currentKey, null);
150 _this.synchronizeTableTr(targetKey, null);
151 }
152 onDragRow && onDragRow(currentKey, targetKey);
153 };
154
155 _this.getTouchDom = function (event) {
156 var currentLocation = event.changedTouches[0];
157 var realTarget = document.elementFromPoint(currentLocation.clientX, currentLocation.clientY);
158 return realTarget;
159 };
160
161 _this.onTouchStart = function (e) {
162 e.stopPropagation();
163 var onDragRowStart = _this.props.onDragRowStart;
164
165 var event = _utils.Event.getEvent(e),
166 _target = _utils.Event.getTarget(event),
167 target = _target.parentNode;
168
169 if (target.tagName === 'TR') {
170
171 _this.currentIndex = target.getAttribute("data-row-key");
172
173 onDragRowStart && onDragRowStart(_this.currentIndex);
174 } else {
175
176 _this.canBeTouch = false;
177 }
178 };
179
180 _this.onTouchMove = function (e) {
181
182 if (!_this.canBeTouch) return;
183 e.stopPropagation();
184 var event = _utils.Event.getEvent(e);
185 event.preventDefault();
186 var touchTarget = _this.getTouchDom(event),
187 target = touchTarget.parentNode,
188 targetKey = target.getAttribute("data-row-key");
189 if (!targetKey || targetKey === _this.currentIndex) return;
190 if (target.nodeName.toUpperCase() === "TR") {
191 if (_this.cacheCurrentIndex !== targetKey) {
192 //模拟 touchenter toucheleave 事件
193 _this.cacheCurrentIndex && _this.synchronizeTableTr(_this.cacheCurrentIndex, null); //去掉虚线
194 _this.synchronizeTableTr(targetKey, true); //添加虚线
195 }
196 }
197 };
198
199 _this.onTouchEnd = function (e) {
200
201 if (!_this.canBeTouch) {
202 _this.canBeTouch = true;
203 return;
204 }
205
206 e.stopPropagation();
207 var onDragRow = _this.props.onDragRow;
208
209 var event = _utils.Event.getEvent(e),
210 currentKey = _this.currentIndex,
211 //拖拽行的key
212 touchTarget = _this.getTouchDom(event),
213 //当前触摸的DOM节点
214 target = touchTarget.parentNode,
215 //目标位置的行
216 targetKey = target.getAttribute("data-row-key"); //目标位置的行key
217 if (!targetKey || targetKey === currentKey) return;
218 if (target.nodeName.toUpperCase() === "TR") {
219 _this.synchronizeTableTr(currentKey, null);
220 _this.synchronizeTableTr(targetKey, null);
221 }
222
223 onDragRow && onDragRow(currentKey, targetKey);
224 };
225
226 _this.synchronizeTableTrShadow = function () {
227 var _this$props = _this.props,
228 contentTable = _this$props.contentTable,
229 index = _this$props.index;
230
231
232 var cont = contentTable.querySelector('.u-table-scroll table tbody').getElementsByTagName("tr")[index],
233 trs = cont.getBoundingClientRect(),
234 fixed_left_trs = contentTable.querySelector('.u-table-fixed-left table tbody'),
235 fixed_right_trs = contentTable.querySelector('.u-table-fixed-right table tbody');
236 fixed_left_trs = fixed_left_trs && fixed_left_trs.getElementsByTagName("tr")[index].getBoundingClientRect();
237 fixed_right_trs = fixed_right_trs && fixed_right_trs.getElementsByTagName("tr")[index].getBoundingClientRect();
238
239 var div = document.createElement("div");
240 var style = "wdith:" + (trs.width + (fixed_left_trs ? fixed_left_trs.width : 0) + (fixed_right_trs ? fixed_right_trs.width : 0)) + "px";
241 style += ";height:" + trs.height + "px";
242 style += ";classname:" + cont.className;
243 div.setAttribute("style", style);
244 return div;
245 };
246
247 _this.synchronizeTableTr = function (currentIndex, type) {
248 if (type) {
249 //同步 this.cacheCurrentIndex
250 _this.cacheCurrentIndex = currentIndex;
251 }
252 var contentTable = _this.props.contentTable;
253
254 var _table_trs = contentTable.querySelector('.u-table-scroll table tbody'),
255 _table_fixed_left_trs = contentTable.querySelector('.u-table-fixed-left table tbody'),
256 _table_fixed_right_trs = contentTable.querySelector('.u-table-fixed-right table tbody');
257
258 _table_trs = _table_trs ? _table_trs : contentTable.querySelector('.u-table table tbody');
259
260 _this.synchronizeTrStyle(_table_trs, currentIndex, type);
261 if (_table_fixed_left_trs) {
262 _this.synchronizeTrStyle(_table_fixed_left_trs, currentIndex, type);
263 }
264 if (_table_fixed_right_trs) {
265 _this.synchronizeTrStyle(_table_fixed_right_trs, currentIndex, type);
266 }
267 };
268
269 _this.synchronizeTrStyle = function (_elementBody, id, type) {
270 var contentTable = _this.props.contentTable,
271 trs = _elementBody.getElementsByTagName("tr"),
272 currentObj = void 0;
273
274 for (var index = 0; index < trs.length; index++) {
275 var element = trs[index];
276 if (element.getAttribute("data-row-key") == id) {
277 currentObj = element;
278 }
279 }
280 if (type) {
281 currentObj && currentObj.setAttribute("style", "border-bottom:2px solid #02B1FD");
282 } else {
283 currentObj && currentObj.setAttribute("style", "");
284 }
285 };
286
287 _this.onDragEnter = function (e) {
288 var event = _utils.Event.getEvent(e),
289 _target = _utils.Event.getTarget(event),
290 target = _target.parentNode;
291 var currentIndex = target.getAttribute("data-row-key");
292 if (!currentIndex || currentIndex === _this.currentIndex) return;
293 if (target.nodeName.toUpperCase() === "TR") {
294 _this.synchronizeTableTr(currentIndex, true);
295 }
296 };
297
298 _this.onDragLeave = function (e) {
299 var event = _utils.Event.getEvent(e),
300 _target = _utils.Event.getTarget(event),
301 target = _target.parentNode;
302 var currentIndex = target.getAttribute("data-row-key");
303 if (!currentIndex || currentIndex === _this.currentIndex) return;
304 if (target.nodeName.toUpperCase() === "TR") {
305 _this.synchronizeTableTr(currentIndex, null);
306 }
307 };
308
309 _this.stopRowDrag = function (isStop) {
310 var rowDraggAble = _this.props.rowDraggAble;
311 var notRowDrag = _this.state.notRowDrag;
312
313 if (rowDraggAble && isStop !== notRowDrag) {
314 _this.setState({
315 notRowDrag: isStop
316 });
317 }
318 };
319
320 _this.set = function (fn) {
321 _this.clear();
322 _this._timeout = window.setTimeout(fn, 300);
323 };
324
325 _this.clear = function (event) {
326 if (_this._timeout) {
327 window.clearTimeout(_this._timeout);
328 }
329 };
330
331 _this.bindElement = function (el) {
332 _this.element = el;
333 };
334
335 _this._timeout = null;
336 _this.state = {
337 hovered: false
338 };
339 _this.onRowClick = _this.onRowClick.bind(_this);
340 _this.onRowDoubleClick = _this.onRowDoubleClick.bind(_this);
341 _this.onMouseEnter = _this.onMouseEnter.bind(_this);
342 _this.onMouseLeave = _this.onMouseLeave.bind(_this);
343 _this.expandHeight = 0;
344 _this.event = false;
345 _this.cacheCurrentIndex = null;
346 _this.canBeTouch = true; //受否允许拖动该行
347 return _this;
348 }
349
350 TableRow.prototype.componentDidMount = function componentDidMount() {
351 var _this2 = this;
352
353 var _props = this.props,
354 store = _props.store,
355 hoverKey = _props.hoverKey,
356 treeType = _props.treeType,
357 rowDraggAble = _props.rowDraggAble;
358
359 this.unsubscribe = store.subscribe(function () {
360 if (store.getState().currentHoverKey === hoverKey) {
361 _this2.setState({ hovered: true });
362 } else if (_this2.state.hovered === true) {
363 _this2.setState({ hovered: false });
364 }
365 });
366
367 this.setRowHeight();
368 if (treeType) {
369 this.setRowParentIndex();
370 }
371 };
372
373 /**
374 * 事件初始化
375 */
376
377
378 /**
379 * 事件移除,提供性能以及内存泄漏等问题。
380 */
381
382
383 /**
384 * 事件绑定和移除函数
385 */
386 TableRow.prototype.eventListen = function eventListen(events, type, eventSource) {
387 for (var i = 0; i < events.length; i++) {
388 var _event = events[i];
389 if (type === "remove") {
390 _utils.EventUtil.removeHandler(eventSource, _event.key, _event.fun);
391 } else {
392 _utils.EventUtil.addHandler(eventSource, _event.key, _event.fun);
393 }
394 }
395 };
396
397 /**
398 * 开始调整交换列的事件
399 */
400
401
402 /**
403 * 在一个拖动过程中,释放鼠标键时触发此事件。【目标事件】
404 * @memberof TableHeader
405 */
406
407
408 /**
409 * 获取当前触摸的Dom节点
410 */
411
412
413 /**
414 * 开始调整交换行的事件
415 */
416
417
418 /**
419 * 手指移开时触发
420 */
421
422
423 /**
424 *同步当前拖拽到阴影
425 * @memberof TableRow
426 */
427
428
429 /**
430 * 同步自己,也需要同步当前行的行显示
431 */
432
433
434 /**
435 * 设置同步的style
436 */
437
438
439 TableRow.prototype.componentDidUpdate = function componentDidUpdate(prevProps) {
440 var _props2 = this.props,
441 rowDraggAble = _props2.rowDraggAble,
442 syncRowHeight = _props2.syncRowHeight;
443
444 if (!this.event) {
445 this.event = true;
446 if (rowDraggAble) {
447 this.initEvent();
448 }
449 }
450 if (this.props.treeType) {
451 this.setRowParentIndex();
452 }
453 // if(syncRowHeight){
454 // this.setRowHeight()
455 // }
456 this.setRowHeight();
457 };
458
459 TableRow.prototype.componentWillUnmount = function componentWillUnmount() {
460 var _props3 = this.props,
461 record = _props3.record,
462 onDestroy = _props3.onDestroy,
463 index = _props3.index,
464 rowDraggAble = _props3.rowDraggAble;
465
466 onDestroy(record, index);
467 if (this.unsubscribe) {
468 this.unsubscribe();
469 }
470 if (rowDraggAble) {
471 this.removeDragAbleEvent();
472 }
473 };
474
475 TableRow.prototype.setRowHeight = function setRowHeight() {
476 var _props4 = this.props,
477 setRowHeight = _props4.setRowHeight,
478 _props4$expandedConte = _props4.expandedContentHeight,
479 expandedContentHeight = _props4$expandedConte === undefined ? 0 : _props4$expandedConte,
480 fixed = _props4.fixed,
481 fixedIndex = _props4.fixedIndex;
482
483 if (!setRowHeight || !this.element || fixed) return;
484 setRowHeight(this.element.clientHeight + expandedContentHeight, fixedIndex);
485 };
486
487 TableRow.prototype.setRowParentIndex = function setRowParentIndex() {
488 var _props5 = this.props,
489 index = _props5.index,
490 setRowParentIndex = _props5.setRowParentIndex,
491 fixedIndex = _props5.fixedIndex,
492 rootIndex = _props5.rootIndex;
493
494 setRowParentIndex(rootIndex < 0 ? index : rootIndex, fixedIndex);
495 };
496
497 TableRow.prototype.onRowClick = function onRowClick(event) {
498 // fix: 解决 onRowClick 回调函数中,事件对象属性均为 null 的问题
499 // 异步访问事件属性
500 // 调用 event.persist() 会从事件池中移除该合成函数并允许对该合成事件的引用被保留下来。
501 event.persist();
502 var _props6 = this.props,
503 record = _props6.record,
504 index = _props6.index,
505 onRowClick = _props6.onRowClick,
506 expandable = _props6.expandable,
507 expandRowByClick = _props6.expandRowByClick,
508 expanded = _props6.expanded,
509 onExpand = _props6.onExpand,
510 fixedIndex = _props6.fixedIndex,
511 onRowDoubleClick = _props6.onRowDoubleClick;
512
513 if (expandable && expandRowByClick) {
514 onExpand(!expanded, record, fixedIndex, event);
515 }
516 if (!onRowDoubleClick) {
517 onRowClick(record, fixedIndex, event);
518 return;
519 }
520 this.set(function (e) {
521 onRowClick(record, fixedIndex, event);
522 });
523 };
524
525 TableRow.prototype.onRowDoubleClick = function onRowDoubleClick(event) {
526 var _props7 = this.props,
527 record = _props7.record,
528 index = _props7.index,
529 onRowDoubleClick = _props7.onRowDoubleClick,
530 fixedIndex = _props7.fixedIndex;
531
532 this.clear();
533 onRowDoubleClick && onRowDoubleClick(record, fixedIndex, event);
534 };
535
536 TableRow.prototype.onMouseEnter = function onMouseEnter(e) {
537 var _props8 = this.props,
538 onHover = _props8.onHover,
539 hoverKey = _props8.hoverKey,
540 fixedIndex = _props8.fixedIndex,
541 syncHover = _props8.syncHover,
542 record = _props8.record;
543
544 if (syncHover) {
545 this.setState({ hovered: true });
546 }
547 onHover(true, hoverKey, e, fixedIndex, record);
548 };
549
550 TableRow.prototype.onMouseLeave = function onMouseLeave(e) {
551 var _props9 = this.props,
552 onHover = _props9.onHover,
553 hoverKey = _props9.hoverKey,
554 fixedIndex = _props9.fixedIndex,
555 syncHover = _props9.syncHover,
556 record = _props9.record;
557
558 if (syncHover) {
559 this.setState({ hovered: false });
560 }
561 onHover(false, hoverKey, e, fixedIndex, record);
562 };
563
564 TableRow.prototype.render = function render() {
565 var _props10 = this.props,
566 clsPrefix = _props10.clsPrefix,
567 columns = _props10.columns,
568 record = _props10.record,
569 height = _props10.height,
570 visible = _props10.visible,
571 index = _props10.index,
572 onPaste = _props10.onPaste,
573 expandIconColumnIndex = _props10.expandIconColumnIndex,
574 expandIconAsCell = _props10.expandIconAsCell,
575 expanded = _props10.expanded,
576 useDragHandle = _props10.useDragHandle,
577 rowDraggAble = _props10.rowDraggAble,
578 expandable = _props10.expandable,
579 onExpand = _props10.onExpand,
580 needIndentSpaced = _props10.needIndentSpaced,
581 indent = _props10.indent,
582 indentSize = _props10.indentSize,
583 isHiddenExpandIcon = _props10.isHiddenExpandIcon,
584 fixed = _props10.fixed,
585 bodyDisplayInRow = _props10.bodyDisplayInRow,
586 expandedIcon = _props10.expandedIcon,
587 collapsedIcon = _props10.collapsedIcon,
588 hoverKey = _props10.hoverKey,
589 lazyStartIndex = _props10.lazyStartIndex,
590 lazyEndIndex = _props10.lazyEndIndex,
591 expandIconCellWidth = _props10.expandIconCellWidth,
592 getCellClassName = _props10.getCellClassName;
593 var notRowDrag = this.state.notRowDrag;
594
595 var showSum = false;
596 var className = this.props.className;
597
598 if (this.state.hovered) {
599 className += ' ' + clsPrefix + '-hover';
600 }
601 //判断是否为合计行
602 if (className.indexOf('sumrow') > -1) {
603 showSum = true;
604 }
605 var cells = [];
606
607 var expandIcon = _react2["default"].createElement(_ExpandIcon2["default"], {
608 expandable: expandable,
609 clsPrefix: clsPrefix,
610 onExpand: onExpand,
611 needIndentSpaced: needIndentSpaced,
612 expanded: expanded,
613 record: record,
614 expandedIcon: expandedIcon,
615 collapsedIcon: collapsedIcon,
616 isHiddenExpandIcon: isHiddenExpandIcon
617 });
618 var isExpandIconAsCell = expandIconAsCell ? clsPrefix + '-expand-columns-in-body' : '';
619 var expandIndexInThisTable;
620 if (this.props.fixed === 'right') {
621 expandIndexInThisTable = expandIconColumnIndex - this.props.leftColumnsLength - this.props.centerColumnsLength;
622 } else {
623 expandIndexInThisTable = expandIconColumnIndex;
624 }
625 for (var i = 0; i < columns.length; i++) {
626 if (expandIconAsCell && i === 0) {
627 showSum ? cells.push(_react2["default"].createElement('td', { width: expandIconCellWidth })) : cells.push(_react2["default"].createElement(
628 'td',
629 {
630 className: clsPrefix + '-expand-icon-cell ' + isExpandIconAsCell,
631 key: 'rc-table-expand-icon-cell-' + i,
632 width: expandIconCellWidth
633 },
634 expandIcon
635 ));
636 }
637 // bugfix 设置expandRowByClick,无法显示箭头,去掉 expandRowByClick 判断
638 var isColumnHaveExpandIcon = expandIconAsCell || showSum ? false : i === expandIndexInThisTable;
639 cells.push(_react2["default"].createElement(_TableCell2["default"], {
640 clsPrefix: clsPrefix,
641 record: record,
642 indentSize: indentSize,
643 indent: indent,
644 index: index,
645 column: columns[i],
646 key: index + "_" + (columns[i].key || columns[i].dataIndex || i),
647 fixed: fixed,
648 showSum: showSum,
649 expandIcon: isColumnHaveExpandIcon ? expandIcon : null,
650 bodyDisplayInRow: bodyDisplayInRow,
651 lazyStartIndex: lazyStartIndex,
652 lazyEndIndex: lazyEndIndex,
653 onPaste: onPaste,
654 stopRowDrag: this.stopRowDrag,
655 col: i,
656 getCellClassName: getCellClassName
657 }));
658 }
659 var style = _extends({ height: height }, record ? record.style : undefined);
660 if (!visible) {
661 style.display = 'none';
662 }
663 if (record && record._checked) {
664 className += ' selected';
665 }
666
667 if (rowDraggAble && !useDragHandle && !notRowDrag) {
668 className += ' row-dragg-able';
669 }
670
671 return _react2["default"].createElement(
672 'tr',
673 {
674 draggable: rowDraggAble && !useDragHandle && !notRowDrag,
675 onClick: this.onRowClick,
676 onDoubleClick: this.onRowDoubleClick,
677 onMouseEnter: this.onMouseEnter,
678 onMouseLeave: this.onMouseLeave,
679 className: clsPrefix + ' ' + className + ' ' + clsPrefix + '-level-' + indent,
680 style: style,
681 'data-row-key': record && record.key ? record.key : hoverKey
682 // key={hoverKey}
683 , ref: this.bindElement
684 },
685 cells.length > 0 ? cells : _react2["default"].createElement('td', { style: { width: 0, padding: 0 } })
686 );
687 };
688
689 return TableRow;
690}(_react.Component);
691
692;
693
694TableRow.propTypes = propTypes;
695TableRow.defaultProps = defaultProps;
696
697exports["default"] = TableRow;
698module.exports = exports['default'];
\No newline at end of file