fast-table-pro
Advanced tools
Comparing version 1.1.0 to 1.6.0
@@ -310,40 +310,10 @@ "use strict"; | ||
for (var i = 0; i < columns.length; i++) { | ||
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 cellKey = "Row[".concat(record[_types.DS._path], "]-Col[").concat(columns[i][_types.CS._pathKey], "]-").concat(i, "_").concat(fixed || '', "-").concat(_this._forceCount); | ||
var cell = void 0; | ||
var cellProps = { | ||
key: cellKey, | ||
className: col.className, | ||
style: _this.getCellStyle(col, record) | ||
className: columns[i].className, | ||
style: _this.getCellStyle(columns[i], 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) { | ||
@@ -358,3 +328,7 @@ cellProps.ExpandedIcon = (0, _ExpandedIcon["default"])({ | ||
cell = /*#__PURE__*/_react["default"].createElement(_TableCell["default"], cellProps, _this.getCellText(col, record)); | ||
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)); | ||
cells.push(cell); | ||
@@ -382,4 +356,3 @@ } | ||
prefixCls = _this$context$props3.prefixCls, | ||
onRow = _this$context$props3.onRow, | ||
rowProps = _this$context$props3.rowProps; | ||
onRow = _this$context$props3.onRow; | ||
var dataManager = _this.context.manager.dataManager; | ||
@@ -405,9 +378,3 @@ var showData = dataManager.showData(); | ||
var key = "Row_".concat(fixed || '', "_").concat(record[_types.DS._path], "_").concat(_this._forceCount); | ||
var defineProps = {}; | ||
if (typeof rowProps === 'function') { | ||
defineProps = rowProps(record, index + _this._startIndex); | ||
} | ||
var rowProps = _objectSpread({ | ||
var rowProps = { | ||
key: key, | ||
@@ -419,4 +386,3 @@ prefixCls: prefixCls, | ||
style: _this.getRowStyle(record, key) | ||
}, defineProps || {}); | ||
}; | ||
if (top === record) rowProps.isTop = true; | ||
@@ -566,3 +532,3 @@ if (bottom === record) rowProps.isBottom = true; | ||
return { | ||
// currentHoverKey, | ||
currentHoverKey: currentHoverKey, | ||
orders: orders | ||
@@ -569,0 +535,0 @@ }; |
@@ -71,3 +71,5 @@ "use strict"; | ||
var style = { | ||
height: height | ||
height: height, | ||
overflowY: sizeManager._hasScrollY ? 'scroll' : 'hidden', | ||
overflowX: sizeManager._hasScrollX ? 'scroll' : 'hidden' | ||
}; | ||
@@ -102,2 +104,4 @@ | ||
if (fixed) { | ||
delete style.overflowX; | ||
delete style.overflowY; | ||
fixed === 'left' && (style.width = columnManager.getWidth(fixed)); | ||
@@ -158,13 +162,7 @@ | ||
return /*#__PURE__*/_react["default"].createElement("div", { | ||
return /*#__PURE__*/_react["default"].createElement("div", _extends({ | ||
key: "bodyTable", | ||
className: "".concat(prefixCls, "-body"), | ||
style: style | ||
}, /*#__PURE__*/_react["default"].createElement("div", _extends({ | ||
style: { | ||
height: '100%', | ||
overflowY: sizeManager._hasScrollY ? 'scroll' : 'hidden', | ||
overflowX: sizeManager._hasScrollX ? 'scroll' : 'hidden' | ||
} | ||
}, bodyProps), baseTable, empty())); | ||
}, bodyProps), baseTable, empty()); | ||
} | ||
@@ -171,0 +169,0 @@ |
@@ -322,4 +322,2 @@ "use strict"; | ||
if (_this.lastScrollTop !== target.scrollTop && target !== headTable) { | ||
_this.lastScrollTop = target.scrollTop; | ||
_this.updateScrollTop(target); | ||
@@ -337,2 +335,4 @@ | ||
} | ||
_this.lastScrollTop = target.scrollTop; | ||
}); | ||
@@ -417,4 +417,4 @@ | ||
state.startIndex = Math.max(0, startIndex - 10); | ||
state.stopIndex = Math.min(state.startIndex + _this.showCount + 10, dataSource.length); | ||
state.startIndex = Math.max(0, startIndex - 1); | ||
state.stopIndex = Math.min(state.startIndex + _this.showCount + 2, dataSource.length); | ||
} | ||
@@ -421,0 +421,0 @@ |
@@ -24,9 +24,3 @@ "use strict"; | ||
}; | ||
return /*#__PURE__*/_react["default"].createElement("div", newProps, SelectIcon, ExpandedIcon, /*#__PURE__*/_react["default"].createElement("div", { | ||
style: { | ||
display: 'inline-block', | ||
overflow: 'hidden', | ||
height: '100%' | ||
} | ||
}, children)); | ||
return /*#__PURE__*/_react["default"].createElement("div", newProps, SelectIcon, ExpandedIcon, children); | ||
} | ||
@@ -33,0 +27,0 @@ |
@@ -30,5 +30,2 @@ "use strict"; | ||
pullDown: false, | ||
roProps: function roProps() { | ||
return {}; | ||
}, | ||
getRowHeight: function getRowHeight() { | ||
@@ -130,3 +127,3 @@ return 1; | ||
click: 'onClick', | ||
dblclick: 'onDoubleClick', | ||
doubleclick: 'onDoubleClick', | ||
blur: 'onBlur', | ||
@@ -136,8 +133,4 @@ focus: 'onFocus', | ||
animationend: 'onAnimationEnd', | ||
transitionend: 'onTransitionEnd', | ||
dragstart: 'onDragStart', | ||
drag: 'onDrag', | ||
dragend: 'onDragEnd', | ||
contextmenu: 'onContextMenu' | ||
transitionend: 'onTransitionEnd' | ||
}; | ||
exports.eventsMap = eventsMap; |
{ | ||
"name": "fast-table-pro", | ||
"version": "1.1.0", | ||
"version": "1.6.0", | ||
"description": "react table fast", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
@@ -0,0 +0,0 @@ import React from 'react'; |
@@ -93,3 +93,5 @@ import React from 'react'; | ||
if (event.type === 'click') { | ||
expandedRowByClick && record[DS._expandedEnable] && expandChange(record[DS._key]); | ||
expandedRowByClick && | ||
record[DS._expandedEnable] && | ||
expandChange(record[DS._key]); | ||
} else if (event.type === 'mouseenter') { | ||
@@ -115,3 +117,5 @@ this.fHover(true, record[DS._key]); | ||
const {columnManager} = this.context.manager; | ||
columnManager.updateGroupedColumns(this.updateColumn(columnManager.groupedColumns(), parent, columns)); | ||
columnManager.updateGroupedColumns( | ||
this.updateColumn(columnManager.groupedColumns(), parent, columns) | ||
); | ||
this._forceCount += 1; | ||
@@ -200,3 +204,6 @@ if (typeof update === 'function') { | ||
rowStyle.top -= | ||
sizeManager._dataHeight + sizeManager.scrollSizeX() - sizeManager._scrollTop - sizeManager._clientBodyHeight; | ||
sizeManager._dataHeight + | ||
sizeManager.scrollSizeX() - | ||
sizeManager._scrollTop - | ||
sizeManager._clientBodyHeight; | ||
} | ||
@@ -248,32 +255,11 @@ rowStyle.zIndex = 1; | ||
for (let i = 0; i < columns.length; i++) { | ||
const col = columns[i]; | ||
const cellKey = `Row[${record[DS._path]}]-Col[${col[CS._pathKey]}]-${i}_${fixed || ''}-${ | ||
this._forceCount | ||
}`; | ||
const cellKey = `Row[${record[DS._path]}]-Col[${ | ||
columns[i][CS._pathKey] | ||
}]-${i}_${fixed || ''}-${this._forceCount}`; | ||
let cell; | ||
const cellProps = { | ||
key: cellKey, | ||
className: col.className, | ||
style: this.getCellStyle(col, record) | ||
className: columns[i].className, | ||
style: this.getCellStyle(columns[i], 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) { | ||
@@ -287,3 +273,6 @@ cellProps.ExpandedIcon = renderExpandedIcon({ | ||
} | ||
cell = <Cell {...cellProps}>{this.getCellText(col, record)}</Cell>; | ||
if (selectManager.enable && fixed !== 'right' && i === 0) { | ||
cellProps.SelectIcon = this.r_select(record, fixed); | ||
} | ||
cell = <Cell {...cellProps}>{this.getCellText(columns[i], record)}</Cell>; | ||
cells.push(cell); | ||
@@ -306,3 +295,3 @@ } | ||
const {fixed, currentHoverKey} = props; | ||
const {prefixCls, onRow, rowProps} = this.context.props; | ||
const {prefixCls, onRow} = this.context.props; | ||
const {dataManager} = this.context.manager; | ||
@@ -318,3 +307,5 @@ const showData = dataManager.showData(); | ||
}); | ||
dataSource = dataSource.filter((d) => !dataManager.isFixed(d)).concat(fixedData); | ||
dataSource = dataSource | ||
.filter((d) => !dataManager.isFixed(d)) | ||
.concat(fixedData); | ||
for (let index = 0; index < dataSource.length; index++) { | ||
@@ -324,6 +315,2 @@ const record = dataSource[index]; | ||
const key = `Row_${fixed || ''}_${record[DS._path]}_${this._forceCount}`; | ||
let defineProps = {}; | ||
if (typeof rowProps === 'function') { | ||
defineProps = rowProps(record, index + this._startIndex); | ||
} | ||
const rowProps = { | ||
@@ -335,8 +322,9 @@ key, | ||
hovered: currentHoverKey === record[DS._key], | ||
style: this.getRowStyle(record, key), | ||
...(defineProps || {}) | ||
style: this.getRowStyle(record, key) | ||
}; | ||
if (top === record) rowProps.isTop = true; | ||
if (bottom === record) rowProps.isBottom = true; | ||
keys(onRow(record) || {}, record[DS._index]).forEach((event) => (rowProps[event] = this.fEvents)); | ||
keys(onRow(record) || {}, record[DS._index]).forEach( | ||
(event) => (rowProps[event] = this.fEvents) | ||
); | ||
['onClick', 'onMouseEnter', 'onMouseLeave'].forEach((event) => { | ||
@@ -382,3 +370,6 @@ if (!has(onRow(record), event)) { | ||
body = ( | ||
<div className='tbody' style={{height: sizeManager._dataHeight, minHeight: rowHeight}}> | ||
<div | ||
className='tbody' | ||
style={{height: sizeManager._dataHeight, minHeight: rowHeight}} | ||
> | ||
{this._children} | ||
@@ -407,5 +398,5 @@ </div> | ||
return { | ||
// currentHoverKey, | ||
currentHoverKey, | ||
orders | ||
}; | ||
})(BaseTable); |
@@ -14,3 +14,9 @@ import React from 'react'; | ||
const {columnManager, sizeManager} = manager; | ||
const {prefixCls, fixedHeader, showHeader, dataSource, bodyMaxHeight} = baseProps; | ||
const { | ||
prefixCls, | ||
fixedHeader, | ||
showHeader, | ||
dataSource, | ||
bodyMaxHeight | ||
} = baseProps; | ||
const {saveRef, fixed, handleBodyScroll, registerForce} = props; | ||
@@ -29,3 +35,4 @@ const baseTable = ( | ||
height = sizeManager._wrapperHeight - sizeManager.footerHeight; | ||
height = height - (showHeader && fixedHeader ? sizeManager._headerHeight : 0); | ||
height = | ||
height - (showHeader && fixedHeader ? sizeManager._headerHeight : 0); | ||
} | ||
@@ -44,3 +51,5 @@ let dataHeight = sizeManager._dataHeight; | ||
const style = { | ||
height | ||
height, | ||
overflowY: sizeManager._hasScrollY ? 'scroll' : 'hidden', | ||
overflowX: sizeManager._hasScrollX ? 'scroll' : 'hidden' | ||
}; | ||
@@ -70,2 +79,4 @@ if (bodyMaxHeight) { | ||
if (fixed) { | ||
delete style.overflowX; | ||
delete style.overflowY; | ||
fixed === 'left' && (style.width = columnManager.getWidth(fixed)); | ||
@@ -76,3 +87,7 @@ if (fixed === 'right' && sizeManager._hasScrollY) { | ||
return ( | ||
<div key='bodyTable' className={`${prefixCls}-body-outer`} style={{...style}}> | ||
<div | ||
key='bodyTable' | ||
className={`${prefixCls}-body-outer`} | ||
style={{...style}} | ||
> | ||
<div | ||
@@ -97,3 +112,10 @@ className={`${prefixCls}-body-inner`} | ||
function empty() { | ||
const {emptyText, dataSource, rowHeight, prefixCls, fixedHeader, showHeader} = baseProps; | ||
const { | ||
emptyText, | ||
dataSource, | ||
rowHeight, | ||
prefixCls, | ||
fixedHeader, | ||
showHeader | ||
} = baseProps; | ||
if (dataSource && dataSource.length > 0) { | ||
@@ -113,3 +135,7 @@ return null; | ||
return ( | ||
<div key='table-empty-text' className={`${prefixCls}-empty-text`} style={emptyStyle}> | ||
<div | ||
key='table-empty-text' | ||
className={`${prefixCls}-empty-text`} | ||
style={emptyStyle} | ||
> | ||
{typeof emptyText === 'function' ? emptyText() : emptyText} | ||
@@ -120,14 +146,10 @@ </div> | ||
return ( | ||
<div key='bodyTable' className={`${prefixCls}-body`} style={style}> | ||
<div | ||
style={{ | ||
height: '100%', | ||
overflowY: sizeManager._hasScrollY ? 'scroll' : 'hidden', | ||
overflowX: sizeManager._hasScrollX ? 'scroll' : 'hidden' | ||
}} | ||
{...bodyProps} | ||
> | ||
{baseTable} | ||
{empty()} | ||
</div> | ||
<div | ||
key='bodyTable' | ||
className={`${prefixCls}-body`} | ||
style={style} | ||
{...bodyProps} | ||
> | ||
{baseTable} | ||
{empty()} | ||
</div> | ||
@@ -134,0 +156,0 @@ ); |
@@ -58,3 +58,5 @@ import React from 'react'; | ||
> | ||
<span style={{width: expandedLevel * indentSize, display: 'inline-block'}} /> | ||
<span | ||
style={{width: expandedLevel * indentSize, display: 'inline-block'}} | ||
/> | ||
{icon || <span style={{width: indentSize, display: 'inline-block'}} />} | ||
@@ -61,0 +63,0 @@ </div> |
@@ -78,3 +78,7 @@ import React from 'react'; | ||
if (sortEnable && children.length === 0) { | ||
cellProps.onClick = () => onSort(column.dataIndex, order === 'desc' || order === true ? 'asc' : 'desc'); | ||
cellProps.onClick = () => | ||
onSort( | ||
column.dataIndex, | ||
order === 'desc' || order === true ? 'asc' : 'desc' | ||
); | ||
} | ||
@@ -97,3 +101,8 @@ | ||
return ( | ||
<div className={current === 0 ? 'row-group' : ''} key={key} style={style} fixed={fixed}> | ||
<div | ||
className={current === 0 ? 'row-group' : ''} | ||
key={key} | ||
style={style} | ||
fixed={fixed} | ||
> | ||
{cell} | ||
@@ -100,0 +109,0 @@ <div className='col-group'> |
@@ -0,0 +0,0 @@ import React from 'react'; |
@@ -107,3 +107,5 @@ import React from 'react'; | ||
const dh = this.sizeManager._dataHeight; | ||
this.selectManager.count = this.selectManager.getKeys(this.dataManager.getData()).length; | ||
this.selectManager.count = this.selectManager.getKeys( | ||
this.dataManager.getData() | ||
).length; | ||
this.sizeManager.update({ | ||
@@ -185,3 +187,6 @@ _dataHeight: this.dataManager._bodyHeight, | ||
} | ||
this.showCount = Math.min(ceil(_height / this.props.rowHeight), dataSource.length); | ||
this.showCount = Math.min( | ||
ceil(_height / this.props.rowHeight), | ||
dataSource.length | ||
); | ||
return count !== this.showCount; | ||
@@ -212,3 +217,4 @@ }; | ||
if (this.sizeManager._wrapperWidth > 0) { | ||
const cWidth = this.sizeManager._wrapperWidth - this.sizeManager.scrollSizeY(); | ||
const cWidth = | ||
this.sizeManager._wrapperWidth - this.sizeManager.scrollSizeY(); | ||
this.sizeManager.update(this.columnManager.updateWidth(cWidth)); | ||
@@ -265,7 +271,9 @@ } | ||
cs.remove(new RegExp(`^${prefixCls}-scroll-position-x-.+$`)); | ||
position.xp !== 'clear' && cs.add(`${prefixCls}-scroll-position-${position.xp}`); | ||
position.xp !== 'clear' && | ||
cs.add(`${prefixCls}-scroll-position-${position.xp}`); | ||
} | ||
if (position.yp) { | ||
cs.remove(new RegExp(`^${prefixCls}-scroll-position-y-.+$`)); | ||
position.yp !== 'clear' && cs.add(`${prefixCls}-scroll-position-${position.yp}`); | ||
position.yp !== 'clear' && | ||
cs.add(`${prefixCls}-scroll-position-${position.yp}`); | ||
} | ||
@@ -326,7 +334,9 @@ } | ||
updateScrollTop = (target) => { | ||
['bodyTable', 'fixedColumnsBodyLeft', 'fixedColumnsBodyRight'].forEach((node) => { | ||
if (this[node] && target !== this[node]) { | ||
this[node].scrollTop = target.scrollTop; | ||
['bodyTable', 'fixedColumnsBodyLeft', 'fixedColumnsBodyRight'].forEach( | ||
(node) => { | ||
if (this[node] && target !== this[node]) { | ||
this[node].scrollTop = target.scrollTop; | ||
} | ||
} | ||
}); | ||
); | ||
}; | ||
@@ -343,3 +353,2 @@ | ||
if (this.lastScrollTop !== target.scrollTop && target !== headTable) { | ||
this.lastScrollTop = target.scrollTop; | ||
this.updateScrollTop(target); | ||
@@ -352,2 +361,3 @@ this.sizeManager.update({_scrollTop: target.scrollTop}); | ||
} | ||
this.lastScrollTop = target.scrollTop; | ||
}; | ||
@@ -357,3 +367,7 @@ | ||
const {scrollEndPosition, onScrollEnd} = this.props; | ||
if (target.scrollTop + target.clientHeight + scrollEndPosition > target.scrollHeight && this.refreshAble) { | ||
if ( | ||
target.scrollTop + target.clientHeight + scrollEndPosition > | ||
target.scrollHeight && | ||
this.refreshAble | ||
) { | ||
if (typeof onScrollEnd === 'function') { | ||
@@ -418,4 +432,7 @@ onScrollEnd(); | ||
} | ||
state.startIndex = Math.max(0, startIndex - 10); | ||
state.stopIndex = Math.min(state.startIndex + this.showCount + 10, dataSource.length); | ||
state.startIndex = Math.max(0, startIndex - 1); | ||
state.stopIndex = Math.min( | ||
state.startIndex + this.showCount + 2, | ||
dataSource.length | ||
); | ||
} | ||
@@ -470,3 +487,4 @@ this.sizeManager.update({ | ||
[`${prefixCls}-expanded`]: this.dataManager.isExpanded(), | ||
[`${prefixCls}-scroll-position-y-top`]: this.sizeManager._hasScrollY && this.sizeManager._scrollTop === 0 | ||
[`${prefixCls}-scroll-position-y-top`]: | ||
this.sizeManager._hasScrollY && this.sizeManager._scrollTop === 0 | ||
}); | ||
@@ -477,3 +495,10 @@ }; | ||
const {fixed} = options; | ||
const headTable = <HeadTable key='head' fixed={fixed} saveRef={this.saveRef} registerForce={this.registerForce} />; | ||
const headTable = ( | ||
<HeadTable | ||
key='head' | ||
fixed={fixed} | ||
saveRef={this.saveRef} | ||
registerForce={this.registerForce} | ||
/> | ||
); | ||
const bodyTable = ( | ||
@@ -525,3 +550,10 @@ <BodyTable | ||
renderEmptyText = () => { | ||
const {emptyText, dataSource, rowHeight, prefixCls, fixedHeader, showHeader} = this.props; | ||
const { | ||
emptyText, | ||
dataSource, | ||
rowHeight, | ||
prefixCls, | ||
fixedHeader, | ||
showHeader | ||
} = this.props; | ||
if (dataSource && dataSource.length > 0) { | ||
@@ -541,3 +573,7 @@ return null; | ||
return ( | ||
<div key='table-empty-text' className={`${prefixCls}-empty-text`} style={style}> | ||
<div | ||
key='table-empty-text' | ||
className={`${prefixCls}-empty-text`} | ||
style={style} | ||
> | ||
{typeof emptyText === 'function' ? emptyText() : emptyText} | ||
@@ -562,3 +598,7 @@ </div> | ||
return ( | ||
<div className={this.getClassName()} ref={this.saveRef('tableNode')} style={style}> | ||
<div | ||
className={this.getClassName()} | ||
ref={this.saveRef('tableNode')} | ||
style={style} | ||
> | ||
<div className={`${prefixCls}-content`}> | ||
@@ -565,0 +605,0 @@ {this.renderMainTable()} |
@@ -13,3 +13,12 @@ import React from 'react'; | ||
const {_path, _pathKey, _currentRow, _width, _minWidth, path, rowSpan, colSpan} = CS; | ||
const { | ||
_path, | ||
_pathKey, | ||
_currentRow, | ||
_width, | ||
_minWidth, | ||
path, | ||
rowSpan, | ||
colSpan | ||
} = CS; | ||
@@ -40,3 +49,5 @@ const percentReg = /^\d+\.?\d{0,2}%$/; | ||
return this._cache('isAnyColumnsLeftFixed', () => { | ||
return this.groupedColumns().some((column) => column.fixed === 'left' || column.fixed === true); | ||
return this.groupedColumns().some( | ||
(column) => column.fixed === 'left' || column.fixed === true | ||
); | ||
}); | ||
@@ -71,3 +82,5 @@ }; | ||
return this._cache('leftColumns', () => { | ||
return this.groupedColumns().filter((column) => column.fixed === 'left' || column.fixed === true); | ||
return this.groupedColumns().filter( | ||
(column) => column.fixed === 'left' || column.fixed === true | ||
); | ||
}); | ||
@@ -83,15 +96,23 @@ }; | ||
leafColumns = () => { | ||
return this._cache('leafColumns', () => this._leafColumns(this.groupedColumns())); | ||
return this._cache('leafColumns', () => | ||
this._leafColumns(this.groupedColumns()) | ||
); | ||
}; | ||
leftLeafColumns = () => { | ||
return this._cache('leftLeafColumns', () => this._leafColumns(this.leftColumns())); | ||
return this._cache('leftLeafColumns', () => | ||
this._leafColumns(this.leftColumns()) | ||
); | ||
}; | ||
rightLeafColumns = () => { | ||
return this._cache('rightLeafColumns', () => this._leafColumns(this.rightColumns())); | ||
return this._cache('rightLeafColumns', () => | ||
this._leafColumns(this.rightColumns()) | ||
); | ||
}; | ||
groupedColumns = () => { | ||
return this._cache('groupedColumns', () => this._updateWidth(this._groupColumns(this.columns))); | ||
return this._cache('groupedColumns', () => | ||
this._updateWidth(this._groupColumns(this.columns)) | ||
); | ||
}; | ||
@@ -148,3 +169,6 @@ | ||
for (let key in c) { | ||
if (typeof key !== 'symbol' && Object.prototype.hasOwnProperty.call(c, key)) { | ||
if ( | ||
typeof key !== 'symbol' && | ||
Object.prototype.hasOwnProperty.call(c, key) | ||
) { | ||
column[key] = c[key]; | ||
@@ -206,3 +230,8 @@ } | ||
const rs = rows.length - currentRow; | ||
if (column && !column.children && rs > 1 && (!column[rowSpan] || column[rowSpan] < rs)) { | ||
if ( | ||
column && | ||
!column.children && | ||
rs > 1 && | ||
(!column[rowSpan] || column[rowSpan] < rs) | ||
) { | ||
column[rowSpan] = rs; | ||
@@ -220,3 +249,8 @@ } | ||
if (newColumn.children && newColumn.children.length > 0) { | ||
newColumn.children = this._groupColumns(newColumn.children, currentRow + 1, newColumn, rows); | ||
newColumn.children = this._groupColumns( | ||
newColumn.children, | ||
currentRow + 1, | ||
newColumn, | ||
rows | ||
); | ||
parentColumn[colSpan] = parentColumn[colSpan] + newColumn[colSpan]; | ||
@@ -246,3 +280,4 @@ newColumn[_width] = sumBy(newColumn.children, _width); | ||
} | ||
this.hasOverflowX = this.width > this.wrapperWidth && this.wrapperWidth !== 0; | ||
this.hasOverflowX = | ||
this.width > this.wrapperWidth && this.wrapperWidth !== 0; | ||
return grouped; | ||
@@ -253,3 +288,5 @@ }; | ||
const wrapperWidth = this.wrapperWidth || 0; | ||
const leftColumns = columns.filter((c) => c.fixed === true || c.fixed === 'left'); | ||
const leftColumns = columns.filter( | ||
(c) => c.fixed === true || c.fixed === 'left' | ||
); | ||
const rightColumns = columns.filter((c) => c.fixed === 'right'); | ||
@@ -259,5 +296,9 @@ const leafColumns = this._leafColumns(columns); | ||
const rightLeafColumns = this._leafColumns(rightColumns); | ||
const len = leafColumns.length - leftLeafColumns.length - rightLeafColumns.length; | ||
const len = | ||
leafColumns.length - leftLeafColumns.length - rightLeafColumns.length; | ||
let last; | ||
let lcArr = leafColumns.filter((c) => !c.fixed && c.fixed !== 'left' && c.fixed !== 'right') || []; | ||
let lcArr = | ||
leafColumns.filter( | ||
(c) => !c.fixed && c.fixed !== 'left' && c.fixed !== 'right' | ||
) || []; | ||
if (leafColumns.length > 0) { | ||
@@ -314,3 +355,10 @@ last = leafColumns[leafColumns.length - 1]; | ||
if (last) { | ||
last[_width] = max([wrapperWidth - this.leftWidth - this.rightWidth - centerWidth + last[_width], last[_width]]); | ||
last[_width] = max([ | ||
wrapperWidth - | ||
this.leftWidth - | ||
this.rightWidth - | ||
centerWidth + | ||
last[_width], | ||
last[_width] | ||
]); | ||
if (cols.length > 1) { | ||
@@ -317,0 +365,0 @@ cols = cols.slice(1); |
@@ -23,3 +23,5 @@ import React from 'react'; | ||
getFixedData = () => { | ||
return this._cache('getFixedData', () => this._getFixedData(this.showData())); | ||
return this._cache('getFixedData', () => | ||
this._getFixedData(this.showData()) | ||
); | ||
}; | ||
@@ -59,3 +61,7 @@ | ||
} | ||
return record['isFixed'] === true || record['isFixed'] === 'top' || record['isFixed'] === 'bottom'; | ||
return ( | ||
record['isFixed'] === true || | ||
record['isFixed'] === 'top' || | ||
record['isFixed'] === 'bottom' | ||
); | ||
}; | ||
@@ -65,3 +71,5 @@ | ||
const _data = data || []; | ||
this._hasExpanded = _data.some((d) => !this.isFixed(d) && (d.children || []).length > 0); | ||
this._hasExpanded = _data.some( | ||
(d) => !this.isFixed(d) && (d.children || []).length > 0 | ||
); | ||
if (!this.getProps('fixedHeader')) { | ||
@@ -76,3 +84,6 @@ this._data = _data; | ||
const children = d.children || []; | ||
return (d['isFixed'] === true || d['isFixed'] === 'top') && children.length === 0; | ||
return ( | ||
(d['isFixed'] === true || d['isFixed'] === 'top') && | ||
children.length === 0 | ||
); | ||
}); | ||
@@ -134,3 +145,5 @@ const bottomData = _data.filter((d) => { | ||
const height = getRowHeight(dataSource[index], index) * rowHeight; | ||
const path = `${parentPath === undefined ? index : `${parentPath}-${index}`}`; | ||
const path = `${ | ||
parentPath === undefined ? index : `${parentPath}-${index}` | ||
}`; | ||
const record = dataSource[index]; | ||
@@ -145,3 +158,4 @@ const children = record['children'] || []; | ||
if (this.isFixed(record)) { | ||
record[DS._isFixed] = record['isFixed'] === true ? 'top' : record['isFixed']; | ||
record[DS._isFixed] = | ||
record['isFixed'] === true ? 'top' : record['isFixed']; | ||
} | ||
@@ -174,6 +188,12 @@ if (children.length > 0) { | ||
record[DS._top] = this._bodyHeight; | ||
record[DS._rowClassName] = this._rowClassName(record, record[DS._showIndex]); | ||
record[DS._rowClassName] = this._rowClassName( | ||
record, | ||
record[DS._showIndex] | ||
); | ||
this._bodyHeight += record[DS._height]; | ||
const children = record.children || []; | ||
const _expanded = expandedKeys.length > 0 && expandedKeys.indexOf(record[DS._key]) > -1 && children.length > 0; | ||
const _expanded = | ||
expandedKeys.length > 0 && | ||
expandedKeys.indexOf(record[DS._key]) > -1 && | ||
children.length > 0; | ||
record[DS._expanded] = _expanded; | ||
@@ -180,0 +200,0 @@ this._hasExpanded && data.push(record); |
@@ -84,3 +84,5 @@ import {DS} from '../types'; | ||
} else { | ||
this._selectedKeys = this._selectedKeys.filter((k) => !keys.includes(k)); | ||
this._selectedKeys = this._selectedKeys.filter( | ||
(k) => !keys.includes(k) | ||
); | ||
} | ||
@@ -87,0 +89,0 @@ } else if (t === 'radio') { |
@@ -0,0 +0,0 @@ import React from 'react'; |
@@ -0,0 +0,0 @@ import React from 'react'; |
@@ -0,0 +0,0 @@ import {Component, createElement} from 'react'; |
@@ -0,0 +0,0 @@ export default function create(initialState) { |
export Provider from './Provider'; | ||
export connect from './connect'; | ||
export create from './create'; |
@@ -0,0 +0,0 @@ import PropTypes from 'prop-types'; |
@@ -0,0 +0,0 @@ import React, {Children, Component} from 'react'; |
@@ -0,0 +0,0 @@ import React from 'react'; |
@@ -0,0 +0,0 @@ import React from 'react'; |
@@ -0,0 +0,0 @@ import React from 'react'; |
@@ -23,3 +23,3 @@ import React from 'react'; | ||
{ExpandedIcon} | ||
<div style={{display: 'inline-block', overflow: 'hidden', height: '100%'}}>{children}</div> | ||
{children} | ||
</div> | ||
@@ -26,0 +26,0 @@ ); |
@@ -18,3 +18,13 @@ import React from 'react'; | ||
function TableHeader(props: Props) { | ||
const {columns, orders, onSort, fixed, headerRowHeight, prefixCls, onHeaderRow, onDrag, SelectIcon} = props; | ||
const { | ||
columns, | ||
orders, | ||
onSort, | ||
fixed, | ||
headerRowHeight, | ||
prefixCls, | ||
onHeaderRow, | ||
onDrag, | ||
SelectIcon | ||
} = props; | ||
let children = columns.map((column, index) => | ||
@@ -31,3 +41,4 @@ HeadCell({ | ||
onDrag, | ||
SelectIcon: index === 0 && fixed !== 'right' && SelectIcon ? SelectIcon : null | ||
SelectIcon: | ||
index === 0 && fixed !== 'right' && SelectIcon ? SelectIcon : null | ||
}) | ||
@@ -34,0 +45,0 @@ ); |
@@ -37,3 +37,2 @@ import React from 'react'; | ||
rowClassName: Function, | ||
rowProps: Function, | ||
emptyText: Function | React.Node, | ||
@@ -82,3 +81,2 @@ expandedRowRender: Function, | ||
roProps: () => ({}), | ||
getRowHeight: () => 1, | ||
@@ -175,3 +173,3 @@ rowClassName: () => '', | ||
click: 'onClick', | ||
dblclick: 'onDoubleClick', | ||
doubleclick: 'onDoubleClick', | ||
blur: 'onBlur', | ||
@@ -181,7 +179,3 @@ focus: 'onFocus', | ||
animationend: 'onAnimationEnd', | ||
transitionend: 'onTransitionEnd', | ||
dragstart: 'onDragStart', | ||
drag: 'onDrag', | ||
dragend: 'onDragEnd', | ||
contextmenu: 'onContextMenu' | ||
transitionend: 'onTransitionEnd' | ||
}; |
@@ -0,0 +0,0 @@ export default function createDetectElementResize(nonce) { |
@@ -0,0 +0,0 @@ import React from 'react'; |
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
285756
7071