fast-table-pro
Advanced tools
Comparing version 1.6.0 to 1.6.1
@@ -388,3 +388,3 @@ "use strict"; | ||
}); | ||
['onClick', 'onMouseEnter', 'onMouseLeave'].forEach(function (event) { | ||
['onMouseEnter', 'onMouseLeave', 'onClick', 'onDoubleClick', 'onBlur', 'onFocus', 'onAnimationStart', 'onAnimationEnd'].forEach(function (event) { | ||
if (!(0, _utils.has)(onRow(record), event)) { | ||
@@ -391,0 +391,0 @@ rowProps[event] = _this.fEvents; |
{ | ||
"name": "fast-table-pro", | ||
"version": "1.6.0", | ||
"version": "1.6.1", | ||
"description": "react table fast", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
@@ -5,8 +5,8 @@ import React from 'react'; | ||
import Row from './TableRow'; | ||
import {connect} from './mini-store'; | ||
import { connect } from './mini-store'; | ||
import renderExpandedIcon from './ExpandedIcon'; | ||
import Cell from './TableCell'; | ||
import Select from './Select'; | ||
import {CS, DS, eventsMap} from './types'; | ||
import {cellAlignStyle, isInvalidRenderCellText, has, keys} from './utils'; | ||
import { CS, DS, eventsMap } from './types'; | ||
import { cellAlignStyle, isInvalidRenderCellText, has, keys } from './utils'; | ||
@@ -41,4 +41,4 @@ type Props = { | ||
this._forceCount = 0; | ||
const {registerForce, fixed, hasHead, hasBody} = this.props; | ||
const {sizeManager} = this.context.manager; | ||
const { registerForce, fixed, hasHead, hasBody } = this.props; | ||
const { sizeManager } = this.context.manager; | ||
if (registerForce) { | ||
@@ -64,3 +64,3 @@ let name = fixed; | ||
event.stopPropagation(); | ||
const {expandChange} = this.context; | ||
const { expandChange } = this.context; | ||
expandChange(event.currentTarget.getAttribute('data-key')); | ||
@@ -70,6 +70,6 @@ }; | ||
fSort = (key, order) => { | ||
const {sortManager} = this.context.manager; | ||
const { sortManager } = this.context.manager; | ||
const onSort = this.context.props.onSort; | ||
sortManager.setOrder(key, order, (orders) => { | ||
this.props.store.setState({orders}); | ||
this.props.store.setState({ orders }); | ||
if (typeof onSort === 'function') { | ||
@@ -83,3 +83,3 @@ onSort(orders, key, order); | ||
const key = event.currentTarget.getAttribute('data-key'); | ||
const {dataManager} = this.context.manager; | ||
const { dataManager } = this.context.manager; | ||
return dataManager.getByKey(key) || {}; | ||
@@ -90,4 +90,4 @@ }; | ||
const record = this.getRowData(event); | ||
const {expandChange} = this.context; | ||
const {expandedRowByClick, onRow} = this.context.props; | ||
const { expandChange } = this.context; | ||
const { expandedRowByClick, onRow } = this.context.props; | ||
const events = onRow(record) || {}; | ||
@@ -110,3 +110,3 @@ const func = eventsMap[event.type]; | ||
fHover = (isHover, key) => { | ||
const {hoverEnable} = this.context.props; | ||
const { hoverEnable } = this.context.props; | ||
if (hoverEnable) { | ||
@@ -120,5 +120,5 @@ this.props.store.setState({ | ||
fDrag = (parent, columns) => { | ||
const {update} = this.context; | ||
const {onHeaderSortable} = this.context.props; | ||
const {columnManager} = this.context.manager; | ||
const { update } = this.context; | ||
const { onHeaderSortable } = this.context.props; | ||
const { columnManager } = this.context.manager; | ||
columnManager.updateGroupedColumns( | ||
@@ -144,3 +144,3 @@ this.updateColumn(columnManager.groupedColumns(), parent, columns) | ||
if (column[CS._pathKey] === parent[CS._pathKey]) { | ||
column = {...column, children: newColumns}; | ||
column = { ...column, children: newColumns }; | ||
} else { | ||
@@ -159,6 +159,6 @@ if (column.children && column.children.length > 0) { | ||
getCellStyle = (column, record) => { | ||
const {onCell} = column; | ||
const { onCell } = column; | ||
const align = column.align || 'left'; | ||
const width = column[CS._width]; | ||
let style = {...cellAlignStyle(align)}; | ||
let style = { ...cellAlignStyle(align) }; | ||
if (width) { | ||
@@ -169,3 +169,3 @@ style.width = width; | ||
if (onCell) { | ||
style = {...style, ...onCell(column, record)}; | ||
style = { ...style, ...onCell(column, record) }; | ||
} | ||
@@ -176,3 +176,3 @@ return style; | ||
getCellText = (column, record) => { | ||
const {render, dataIndex} = column; | ||
const { render, dataIndex } = column; | ||
let text = (record || {})[dataIndex]; | ||
@@ -188,4 +188,4 @@ if (typeof render === 'function') { | ||
recomputeBody = ({startIndex, stopIndex}) => { | ||
const {hasBody} = this.props; | ||
recomputeBody = ({ startIndex, stopIndex }) => { | ||
const { hasBody } = this.props; | ||
if (hasBody) { | ||
@@ -202,3 +202,3 @@ this._startIndex = startIndex; | ||
getRowStyle = (record, key) => { | ||
const {sizeManager} = this.context.manager; | ||
const { sizeManager } = this.context.manager; | ||
let rowStyle = { | ||
@@ -227,3 +227,3 @@ position: 'absolute', | ||
h_selectAll = () => { | ||
const {selectManager, dataManager} = this.context.manager; | ||
const { selectManager, dataManager } = this.context.manager; | ||
const keys = selectManager.getKeys(dataManager.getData()); | ||
@@ -234,4 +234,4 @@ selectManager.selectAll(keys); | ||
r_selectAll = () => { | ||
const {prefixCls} = this.context.props; | ||
const {selectManager, dataManager} = this.context.manager; | ||
const { prefixCls } = this.context.props; | ||
const { selectManager, dataManager } = this.context.manager; | ||
const keys = selectManager.getKeys(dataManager.getData()); | ||
@@ -248,4 +248,4 @@ selectManager.count = keys.length; | ||
r_select = (record) => { | ||
const {prefixCls} = this.context.props; | ||
const {selectManager} = this.context.manager; | ||
const { prefixCls } = this.context.props; | ||
const { selectManager } = this.context.manager; | ||
const selected = selectManager.selectedKeys.includes(record[DS._key]); | ||
@@ -262,5 +262,5 @@ return Select({ | ||
renderCells = (props, record) => { | ||
const {fixed} = props; | ||
const {prefixCls, indentSize} = this.context.props; | ||
const {dataManager, columnManager, selectManager} = this.context.manager; | ||
const { fixed } = props; | ||
const { prefixCls, indentSize } = this.context.props; | ||
const { dataManager, columnManager, selectManager } = this.context.manager; | ||
const columns = columnManager.bodyColumns(fixed); | ||
@@ -270,5 +270,4 @@ const hasExpanded = dataManager._hasExpanded; | ||
for (let i = 0; i < columns.length; i++) { | ||
const cellKey = `Row[${record[DS._path]}]-Col[${ | ||
columns[i][CS._pathKey] | ||
}]-${i}_${fixed || ''}-${this._forceCount}`; | ||
const cellKey = `Row[${record[DS._path]}]-Col[${columns[i][CS._pathKey] | ||
}]-${i}_${fixed || ''}-${this._forceCount}`; | ||
let cell; | ||
@@ -298,3 +297,3 @@ const cellProps = { | ||
renderRowChildren = (props, record) => { | ||
const {expandedRowRender} = this.context.props; | ||
const { expandedRowRender } = this.context.props; | ||
if (expandedRowRender && record[DS._expandedLevel] > 0) { | ||
@@ -309,5 +308,5 @@ return expandedRowRender(record, props.fixed, record[DS._expandedLevel]); | ||
const rows = []; | ||
const {fixed, currentHoverKey} = props; | ||
const {prefixCls, onRow} = this.context.props; | ||
const {dataManager} = this.context.manager; | ||
const { fixed, currentHoverKey } = props; | ||
const { prefixCls, onRow } = this.context.props; | ||
const { dataManager } = this.context.manager; | ||
const showData = dataManager.showData(); | ||
@@ -342,3 +341,11 @@ let dataSource = showData.slice(this._startIndex, this._stopIndex); | ||
); | ||
['onClick', 'onMouseEnter', 'onMouseLeave'].forEach((event) => { | ||
['onMouseEnter', | ||
'onMouseLeave', | ||
'onClick', | ||
'onDoubleClick', | ||
'onBlur', | ||
'onFocus', | ||
'onAnimationStart', | ||
'onAnimationEnd' | ||
].forEach((event) => { | ||
if (!has(onRow(record), event)) { | ||
@@ -355,5 +362,5 @@ rowProps[event] = this.fEvents; | ||
r_header = () => { | ||
const {hasHead, fixed, orders} = this.props; | ||
const {columnManager, selectManager} = this.context.manager; | ||
const {prefixCls, headerRowHeight, onHeaderRow} = this.context.props; | ||
const { hasHead, fixed, orders } = this.props; | ||
const { columnManager, selectManager } = this.context.manager; | ||
const { prefixCls, headerRowHeight, onHeaderRow } = this.context.props; | ||
if (!hasHead) return null; | ||
@@ -378,5 +385,5 @@ const props = { | ||
render() { | ||
const {hasBody, fixed} = this.props; | ||
const {columnManager, sizeManager} = this.context.manager; | ||
const {rowHeight} = this.context.props; | ||
const { hasBody, fixed } = this.props; | ||
const { columnManager, sizeManager } = this.context.manager; | ||
const { rowHeight } = this.context.props; | ||
let body; | ||
@@ -387,3 +394,3 @@ if (hasBody) { | ||
className='tbody' | ||
style={{height: sizeManager._dataHeight, minHeight: rowHeight}} | ||
style={{ height: sizeManager._dataHeight, minHeight: rowHeight }} | ||
> | ||
@@ -396,3 +403,3 @@ {this._children} | ||
const width = columnManager.getWidth(fixed) || '100%'; | ||
const style = {width}; | ||
const style = { width }; | ||
if (!fixed) { | ||
@@ -412,3 +419,3 @@ style.minWidth = '100%'; | ||
export default connect((state) => { | ||
const {currentHoverKey, orders} = state; | ||
const { currentHoverKey, orders } = state; | ||
return { | ||
@@ -415,0 +422,0 @@ currentHoverKey, |
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
286052
7078