fast-table
Advanced tools
Comparing version 1.4.8-beta.41 to 1.4.8-beta.42
@@ -310,10 +310,40 @@ "use strict"; | ||
for (var i = 0; i < columns.length; i++) { | ||
var cellKey = "Row[".concat(record[_types.DS._path], "]-Col[").concat(columns[i][_types.CS._pathKey], "]-").concat(i, "_").concat(fixed || '', "-").concat(_this._forceCount); | ||
var col = columns[i]; | ||
var cellKey = "Row[".concat(record[_types.DS._path], "]-Col[").concat(col[_types.CS._pathKey], "]-").concat(i, "_").concat(fixed || '', "-").concat(_this._forceCount); | ||
var cell = void 0; | ||
var cellProps = { | ||
key: cellKey, | ||
className: columns[i].className, | ||
style: _this.getCellStyle(columns[i], record) | ||
className: col.className, | ||
style: _this.getCellStyle(col, record) | ||
}; | ||
if (selectManager.enable && fixed !== 'right' && i === 0) { | ||
cellProps.SelectIcon = _this.r_select(record, fixed); | ||
} | ||
if (typeof col.onColSpan === 'function') { | ||
var span = col.onColSpan(col, record); | ||
if (typeof span !== 'number' || isNaN(span)) { | ||
span = 1; | ||
} | ||
if (span > 1) { | ||
var spanWidth = 0; | ||
for (var j = 0; j < span; j += 1) { | ||
var _this$getCellStyle = _this.getCellStyle(columns[i], record), | ||
width = _this$getCellStyle.width; | ||
if (typeof width === 'number') spanWidth += width; | ||
if (j < span - 1) { | ||
i += 1; | ||
} | ||
} | ||
cellProps.style.width = spanWidth; | ||
} | ||
} | ||
if (hasExpanded && fixed !== 'right' && i === 0) { | ||
@@ -328,7 +358,3 @@ cellProps.ExpandedIcon = (0, _ExpandedIcon["default"])({ | ||
if (selectManager.enable && fixed !== 'right' && i === 0) { | ||
cellProps.SelectIcon = _this.r_select(record, fixed); | ||
} | ||
cell = /*#__PURE__*/_react["default"].createElement(_TableCell["default"], cellProps, _this.getCellText(columns[i], record)); | ||
cell = /*#__PURE__*/_react["default"].createElement(_TableCell["default"], cellProps, _this.getCellText(col, record)); | ||
cells.push(cell); | ||
@@ -335,0 +361,0 @@ } |
@@ -137,4 +137,5 @@ "use strict"; | ||
drag: 'onDrag', | ||
dragend: 'onDragEnd' | ||
dragend: 'onDragEnd', | ||
contextmenu: 'onContextMenu' | ||
}; | ||
exports.eventsMap = eventsMap; |
{ | ||
"name": "fast-table", | ||
"version": "1.4.8-beta.41", | ||
"version": "1.4.8-beta.42", | ||
"description": "react table fast", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
@@ -106,2 +106,3 @@ <p align="center"> | ||
| width | width | String `or` Number | - | | ||
| onColSpan | merge cell | Function(column, record):Number | | | ||
@@ -325,1 +326,3 @@ # DataSource Props | ||
- fixed onClick bug | ||
- 1.4.8-beta-42 | ||
- 添加水平单元格合并 |
@@ -245,3 +245,4 @@ import React from 'react'; | ||
for (let i = 0; i < columns.length; i++) { | ||
const cellKey = `Row[${record[DS._path]}]-Col[${columns[i][CS._pathKey]}]-${i}_${fixed || ''}-${ | ||
const col = columns[i]; | ||
const cellKey = `Row[${record[DS._path]}]-Col[${col[CS._pathKey]}]-${i}_${fixed || ''}-${ | ||
this._forceCount | ||
@@ -252,5 +253,25 @@ }`; | ||
key: cellKey, | ||
className: columns[i].className, | ||
style: this.getCellStyle(columns[i], record) | ||
className: col.className, | ||
style: this.getCellStyle(col, record) | ||
}; | ||
if (selectManager.enable && fixed !== 'right' && i === 0) { | ||
cellProps.SelectIcon = this.r_select(record, fixed); | ||
} | ||
if (typeof col.onColSpan === 'function') { | ||
let span = col.onColSpan(col, record); | ||
if (typeof span !== 'number' || isNaN(span)) { | ||
span = 1; | ||
} | ||
if (span > 1) { | ||
let spanWidth = 0; | ||
for (let j = 0; j < span; j += 1) { | ||
const {width} = this.getCellStyle(columns[i], record); | ||
if (typeof width === 'number') spanWidth += width; | ||
if (j < span - 1) { | ||
i += 1; | ||
} | ||
} | ||
cellProps.style.width = spanWidth; | ||
} | ||
} | ||
if (hasExpanded && fixed !== 'right' && i === 0) { | ||
@@ -264,6 +285,3 @@ cellProps.ExpandedIcon = renderExpandedIcon({ | ||
} | ||
if (selectManager.enable && fixed !== 'right' && i === 0) { | ||
cellProps.SelectIcon = this.r_select(record, fixed); | ||
} | ||
cell = <Cell {...cellProps}>{this.getCellText(columns[i], record)}</Cell>; | ||
cell = <Cell {...cellProps}>{this.getCellText(col, record)}</Cell>; | ||
cells.push(cell); | ||
@@ -270,0 +288,0 @@ } |
@@ -181,3 +181,4 @@ import React from 'react'; | ||
drag: 'onDrag', | ||
dragend: 'onDragEnd' | ||
dragend: 'onDragEnd', | ||
contextmenu: 'onContextMenu' | ||
}; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
284332
6952
326