rsuite-table
Advanced tools
Comparing version 3.14.6 to 3.15.0
@@ -0,1 +1,6 @@ | ||
# 3.15.0 | ||
- fix(ColumnGroup): fix column cannot be sorted in ColumnGroup | ||
- fix(propTypes): fix unable to get propTypes after gatsby is compiled | ||
# 3.14.6 | ||
@@ -2,0 +7,0 @@ |
@@ -122,3 +122,3 @@ import _extends from "@babel/runtime/helpers/esm/extends"; | ||
_proto.render = function render() { | ||
var _classNames, _styles, _extends2; | ||
var _classNames, _extends2, _contentStyles; | ||
@@ -156,13 +156,14 @@ var _this$props6 = this.props, | ||
var nextHeight = isHeaderCell ? headerHeight : this.getHeight(); | ||
var styles = (_styles = { | ||
var styles = _extends({}, style, (_extends2 = { | ||
width: width, | ||
height: nextHeight, | ||
zIndex: depth | ||
}, _styles[rtl ? 'right' : 'left'] = left, _styles); | ||
}, _extends2[rtl ? 'right' : 'left'] = left, _extends2)); | ||
var contentStyles = _extends((_extends2 = { | ||
var contentStyles = (_contentStyles = { | ||
width: width, | ||
height: nextHeight, | ||
textAlign: align | ||
}, _extends2[rtl ? 'paddingRight' : 'paddingLeft'] = this.isTreeCol() ? depth * LAYER_WIDTH + 10 : null, _extends2), style); | ||
}, _contentStyles[rtl ? 'paddingRight' : 'paddingLeft'] = this.isTreeCol() ? depth * LAYER_WIDTH + 10 : null, _contentStyles); | ||
@@ -181,3 +182,3 @@ if (verticalAlign) { | ||
var unhandledProps = getUnhandledProps(Cell, getUnhandledProps(Column, rest)); | ||
var unhandledProps = getUnhandledProps(propTypes, getUnhandledProps(Column.propTypes, rest)); | ||
var cell = renderCell ? renderCell(cellContent) : cellContent; | ||
@@ -184,0 +185,0 @@ var content = wordWrap ? /*#__PURE__*/React.createElement("div", { |
@@ -9,2 +9,11 @@ import _extends from "@babel/runtime/helpers/esm/extends"; | ||
import TableContext from './TableContext'; | ||
var propTypes = { | ||
fixed: PropTypes.oneOf(['left', 'right']), | ||
width: PropTypes.number, | ||
height: PropTypes.number, | ||
left: PropTypes.number, | ||
style: PropTypes.object, | ||
className: PropTypes.string, | ||
classPrefix: PropTypes.string | ||
}; | ||
@@ -53,3 +62,3 @@ var CellGroup = /*#__PURE__*/function (_React$PureComponent) { | ||
var unhandledProps = getUnhandledProps(CellGroup, rest); | ||
var unhandledProps = getUnhandledProps(propTypes, rest); | ||
return /*#__PURE__*/React.createElement(TableContext.Consumer, null, function (_ref) { | ||
@@ -68,11 +77,3 @@ var translateDOMPositionXY = _ref.translateDOMPositionXY; | ||
CellGroup.propTypes = { | ||
fixed: PropTypes.oneOf(['left', 'right']), | ||
width: PropTypes.number, | ||
height: PropTypes.number, | ||
left: PropTypes.number, | ||
style: PropTypes.object, | ||
className: PropTypes.string, | ||
classPrefix: PropTypes.string | ||
}; | ||
CellGroup.propTypes = propTypes; | ||
CellGroup.defaultProps = { | ||
@@ -79,0 +80,0 @@ classPrefix: defaultClassPrefix('table-cell-group') |
@@ -40,3 +40,3 @@ import _extends from "@babel/runtime/helpers/esm/extends"; | ||
}, header)), React.Children.map(children, function (node) { | ||
var _node$props, _node$props2, _node$props2$style; | ||
var _node$props; | ||
@@ -49,14 +49,9 @@ var nodeStyles = _extends({ | ||
var width = (_node$props2 = node.props) === null || _node$props2 === void 0 ? void 0 : (_node$props2$style = _node$props2.style) === null || _node$props2$style === void 0 ? void 0 : _node$props2$style.width; | ||
var nodeContentStyles = { | ||
height: height, | ||
width: width, | ||
verticalAlign: verticalAlign | ||
}; | ||
return /*#__PURE__*/React.cloneElement(node, { | ||
className: addPrefix('cell'), | ||
style: nodeStyles, | ||
children: /*#__PURE__*/React.createElement("div", { | ||
className: addPrefix('cell-content'), | ||
style: nodeContentStyles | ||
headerHeight: height, | ||
verticalAlign: verticalAlign, | ||
children: /*#__PURE__*/React.createElement("span", { | ||
className: addPrefix('cell-content') | ||
}, node.props.children) | ||
@@ -63,0 +58,0 @@ }); |
@@ -11,2 +11,14 @@ import _extends from "@babel/runtime/helpers/esm/extends"; | ||
import TableContext from './TableContext'; | ||
var propTypes = { | ||
height: PropTypes.number, | ||
defaultColumnWidth: PropTypes.number, | ||
columnLeft: PropTypes.number, | ||
columnFixed: PropTypes.oneOfType([PropTypes.bool, PropTypes.oneOf(['left', 'right'])]), | ||
className: PropTypes.string, | ||
classPrefix: PropTypes.string, | ||
style: PropTypes.object, | ||
onColumnResizeStart: PropTypes.func, | ||
onColumnResizeEnd: PropTypes.func, | ||
onColumnResizeMove: PropTypes.func | ||
}; | ||
@@ -106,3 +118,3 @@ var ColumnResizeHandler = /*#__PURE__*/function (_React$Component) { | ||
var classes = classNames(classPrefix, className); | ||
var unhandled = getUnhandledProps(ColumnResizeHandler, rest); | ||
var unhandled = getUnhandledProps(propTypes, rest); | ||
return /*#__PURE__*/React.createElement("div", _extends({}, unhandled, { | ||
@@ -121,14 +133,3 @@ className: classes, | ||
ColumnResizeHandler.contextType = TableContext; | ||
ColumnResizeHandler.propTypes = { | ||
height: PropTypes.number, | ||
defaultColumnWidth: PropTypes.number, | ||
columnLeft: PropTypes.number, | ||
columnFixed: PropTypes.oneOfType([PropTypes.bool, PropTypes.oneOf(['left', 'right'])]), | ||
className: PropTypes.string, | ||
classPrefix: PropTypes.string, | ||
style: PropTypes.object, | ||
onColumnResizeStart: PropTypes.func, | ||
onColumnResizeEnd: PropTypes.func, | ||
onColumnResizeMove: PropTypes.func | ||
}; | ||
ColumnResizeHandler.propTypes = propTypes; | ||
ColumnResizeHandler.defaultProps = { | ||
@@ -135,0 +136,0 @@ classPrefix: defaultClassPrefix('table-column-resize-spanner') |
@@ -10,2 +10,17 @@ import _extends from "@babel/runtime/helpers/esm/extends"; | ||
import Cell from './Cell'; | ||
var propTypes = { | ||
index: PropTypes.number, | ||
sortColumn: PropTypes.string, | ||
sortType: PropTypes.oneOf(['desc', 'asc']), | ||
sortable: PropTypes.bool, | ||
resizable: PropTypes.bool, | ||
onColumnResizeStart: PropTypes.func, | ||
onColumnResizeEnd: PropTypes.func, | ||
onResize: PropTypes.func, | ||
onColumnResizeMove: PropTypes.func, | ||
onSortColumn: PropTypes.func, | ||
flexGrow: PropTypes.number, | ||
fixed: PropTypes.oneOfType([PropTypes.bool, PropTypes.oneOf(['left', 'right'])]), | ||
children: PropTypes.node | ||
}; | ||
@@ -108,5 +123,6 @@ var HeaderCell = /*#__PURE__*/function (_React$PureComponent) { | ||
sortType = _this$props5$sortType === void 0 ? '' : _this$props5$sortType, | ||
dataKey = _this$props5.dataKey; | ||
dataKey = _this$props5.dataKey, | ||
groupHeader = _this$props5.groupHeader; | ||
if (sortable) { | ||
if (sortable && !groupHeader) { | ||
var _classNames; | ||
@@ -139,6 +155,7 @@ | ||
sortType = _this$props6.sortType, | ||
rest = _objectWithoutPropertiesLoose(_this$props6, ["className", "width", "dataKey", "headerHeight", "children", "left", "sortable", "classPrefix", "sortColumn", "sortType"]); | ||
groupHeader = _this$props6.groupHeader, | ||
rest = _objectWithoutPropertiesLoose(_this$props6, ["className", "width", "dataKey", "headerHeight", "children", "left", "sortable", "classPrefix", "sortColumn", "sortType", "groupHeader"]); | ||
var classes = classNames(classPrefix, className, (_classNames2 = {}, _classNames2[this.addPrefix('sortable')] = sortable, _classNames2)); | ||
var unhandledProps = getUnhandledProps(HeaderCell, rest); | ||
var unhandledProps = getUnhandledProps(propTypes, rest); | ||
var ariaSort; | ||
@@ -166,3 +183,3 @@ | ||
isHeaderCell: true, | ||
onClick: this.handleClick | ||
onClick: !groupHeader ? this.handleClick : null | ||
}), children, this.renderSortColumn()), this.renderResizeSpanner()); | ||
@@ -174,17 +191,3 @@ }; | ||
HeaderCell.propTypes = { | ||
index: PropTypes.number, | ||
sortColumn: PropTypes.string, | ||
sortType: PropTypes.oneOf(['desc', 'asc']), | ||
sortable: PropTypes.bool, | ||
resizable: PropTypes.bool, | ||
onColumnResizeStart: PropTypes.func, | ||
onColumnResizeEnd: PropTypes.func, | ||
onResize: PropTypes.func, | ||
onColumnResizeMove: PropTypes.func, | ||
onSortColumn: PropTypes.func, | ||
flexGrow: PropTypes.number, | ||
fixed: PropTypes.oneOfType([PropTypes.bool, PropTypes.oneOf(['left', 'right'])]), | ||
children: PropTypes.node | ||
}; | ||
HeaderCell.propTypes = propTypes; | ||
HeaderCell.defaultProps = { | ||
@@ -191,0 +194,0 @@ classPrefix: defaultClassPrefix('table-cell-header') |
@@ -9,2 +9,13 @@ import _extends from "@babel/runtime/helpers/esm/extends"; | ||
import TableContext from './TableContext'; | ||
var propTypes = { | ||
width: PropTypes.number, | ||
height: PropTypes.number, | ||
headerHeight: PropTypes.number, | ||
top: PropTypes.number, | ||
isHeaderRow: PropTypes.bool, | ||
rowRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]), | ||
className: PropTypes.string, | ||
classPrefix: PropTypes.string, | ||
style: PropTypes.object | ||
}; | ||
@@ -44,3 +55,3 @@ var Row = /*#__PURE__*/function (_React$PureComponent) { | ||
var unhandledProps = getUnhandledProps(Row, rest); | ||
var unhandledProps = getUnhandledProps(propTypes, rest); | ||
return /*#__PURE__*/React.createElement(TableContext.Consumer, null, function (_ref) { | ||
@@ -62,13 +73,3 @@ var translateDOMPositionXY = _ref.translateDOMPositionXY; | ||
Row.propTypes = { | ||
width: PropTypes.number, | ||
height: PropTypes.number, | ||
headerHeight: PropTypes.number, | ||
top: PropTypes.number, | ||
isHeaderRow: PropTypes.bool, | ||
rowRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]), | ||
className: PropTypes.string, | ||
classPrefix: PropTypes.string, | ||
style: PropTypes.object | ||
}; | ||
Row.propTypes = propTypes; | ||
Row.defaultProps = { | ||
@@ -75,0 +76,0 @@ classPrefix: defaultClassPrefix('table-row'), |
@@ -11,2 +11,12 @@ import _extends from "@babel/runtime/helpers/esm/extends"; | ||
import TableContext from './TableContext'; | ||
var propTypes = { | ||
tableId: PropTypes.string, | ||
vertical: PropTypes.bool, | ||
length: PropTypes.number, | ||
scrollLength: PropTypes.number, | ||
className: PropTypes.string, | ||
classPrefix: PropTypes.string, | ||
onScroll: PropTypes.func, | ||
onMouseDown: PropTypes.func | ||
}; | ||
@@ -198,3 +208,3 @@ var Scrollbar = /*#__PURE__*/function (_React$PureComponent) { | ||
var styles = (_styles = {}, _styles[vertical ? 'height' : 'width'] = width + "%", _styles[vertical ? 'minHeight' : 'minWidth'] = SCROLLBAR_MIN_WIDTH, _styles); | ||
var unhandled = getUnhandledProps(Scrollbar, rest); | ||
var unhandled = getUnhandledProps(propTypes, rest); | ||
var valuenow = this.scrollOffset / length * 100 + width; | ||
@@ -226,12 +236,3 @@ return /*#__PURE__*/React.createElement("div", _extends({ | ||
Scrollbar.contextType = TableContext; | ||
Scrollbar.propTypes = { | ||
tableId: PropTypes.string, | ||
vertical: PropTypes.bool, | ||
length: PropTypes.number, | ||
scrollLength: PropTypes.number, | ||
className: PropTypes.string, | ||
classPrefix: PropTypes.string, | ||
onScroll: PropTypes.func, | ||
onMouseDown: PropTypes.func | ||
}; | ||
Scrollbar.propTypes = propTypes; | ||
Scrollbar.defaultProps = { | ||
@@ -238,0 +239,0 @@ classPrefix: defaultClassPrefix('table-scrollbar'), |
110
es/Table.js
@@ -28,2 +28,53 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose"; | ||
}; | ||
var propTypes = { | ||
autoHeight: PropTypes.bool, | ||
affixHeader: PropTypes.oneOfType([PropTypes.bool, PropTypes.number]), | ||
affixHorizontalScrollbar: PropTypes.oneOfType([PropTypes.bool, PropTypes.number]), | ||
bordered: PropTypes.bool, | ||
bodyRef: PropTypes.func, | ||
className: PropTypes.string, | ||
classPrefix: PropTypes.string, | ||
children: PropTypes.any, | ||
cellBordered: PropTypes.bool, | ||
data: PropTypes.arrayOf(PropTypes.object), | ||
defaultExpandAllRows: PropTypes.bool, | ||
defaultExpandedRowKeys: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number])), | ||
defaultSortType: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]), | ||
disabledScroll: PropTypes.bool, | ||
expandedRowKeys: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number])), | ||
hover: PropTypes.bool, | ||
height: PropTypes.number, | ||
headerHeight: PropTypes.number, | ||
locale: PropTypes.object, | ||
loading: PropTypes.bool, | ||
loadAnimation: PropTypes.bool, | ||
minHeight: PropTypes.number, | ||
rowKey: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), | ||
rowHeight: PropTypes.oneOfType([PropTypes.number, PropTypes.func]), | ||
renderTreeToggle: PropTypes.func, | ||
renderRowExpanded: PropTypes.func, | ||
rowExpandedHeight: PropTypes.number, | ||
renderEmpty: PropTypes.func, | ||
renderLoading: PropTypes.func, | ||
rowClassName: PropTypes.oneOfType([PropTypes.func, PropTypes.string]), | ||
rtl: PropTypes.bool, | ||
style: PropTypes.object, | ||
sortColumn: PropTypes.string, | ||
sortType: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]), | ||
showHeader: PropTypes.bool, | ||
shouldUpdateScroll: PropTypes.bool, | ||
translate3d: PropTypes.bool, | ||
wordWrap: PropTypes.bool, | ||
width: PropTypes.number, | ||
virtualized: PropTypes.bool, | ||
isTree: PropTypes.bool, | ||
onRowClick: PropTypes.func, | ||
onRowContextMenu: PropTypes.func, | ||
onScroll: PropTypes.func, | ||
onSortColumn: PropTypes.func, | ||
onExpandChange: PropTypes.func, | ||
onTouchStart: PropTypes.func, | ||
onTouchMove: PropTypes.func, | ||
onDataUpdated: PropTypes.func | ||
}; | ||
@@ -755,7 +806,7 @@ var Table = /*#__PURE__*/function (_React$Component) { | ||
// 把 ColumnGroup 设置的属性覆盖到 Column | ||
var groupCellProps = { | ||
var groupCellProps = _extends({}, childColumn === null || childColumn === void 0 ? void 0 : childColumn.props, { | ||
align: align, | ||
fixed: fixed, | ||
verticalAlign: verticalAlign | ||
}; | ||
}); | ||
/** | ||
@@ -768,2 +819,3 @@ * 为分组中的第一列设置属性: | ||
if (index === 0) { | ||
@@ -1583,3 +1635,3 @@ groupCellProps.groupCount = childColumns.length; | ||
var unhandled = getUnhandledProps(Table, rest); | ||
var unhandled = getUnhandledProps(propTypes, rest); | ||
return /*#__PURE__*/React.createElement(TableContext.Provider, { | ||
@@ -1608,53 +1660,3 @@ value: { | ||
Table.propTypes = { | ||
autoHeight: PropTypes.bool, | ||
affixHeader: PropTypes.oneOfType([PropTypes.bool, PropTypes.number]), | ||
affixHorizontalScrollbar: PropTypes.oneOfType([PropTypes.bool, PropTypes.number]), | ||
bordered: PropTypes.bool, | ||
bodyRef: PropTypes.func, | ||
className: PropTypes.string, | ||
classPrefix: PropTypes.string, | ||
children: PropTypes.any, | ||
cellBordered: PropTypes.bool, | ||
data: PropTypes.arrayOf(PropTypes.object), | ||
defaultExpandAllRows: PropTypes.bool, | ||
defaultExpandedRowKeys: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number])), | ||
defaultSortType: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]), | ||
disabledScroll: PropTypes.bool, | ||
expandedRowKeys: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number])), | ||
hover: PropTypes.bool, | ||
height: PropTypes.number, | ||
headerHeight: PropTypes.number, | ||
locale: PropTypes.object, | ||
loading: PropTypes.bool, | ||
loadAnimation: PropTypes.bool, | ||
minHeight: PropTypes.number, | ||
rowKey: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), | ||
rowHeight: PropTypes.oneOfType([PropTypes.number, PropTypes.func]), | ||
renderTreeToggle: PropTypes.func, | ||
renderRowExpanded: PropTypes.func, | ||
rowExpandedHeight: PropTypes.number, | ||
renderEmpty: PropTypes.func, | ||
renderLoading: PropTypes.func, | ||
rowClassName: PropTypes.oneOfType([PropTypes.func, PropTypes.string]), | ||
rtl: PropTypes.bool, | ||
style: PropTypes.object, | ||
sortColumn: PropTypes.string, | ||
sortType: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]), | ||
showHeader: PropTypes.bool, | ||
shouldUpdateScroll: PropTypes.bool, | ||
translate3d: PropTypes.bool, | ||
wordWrap: PropTypes.bool, | ||
width: PropTypes.number, | ||
virtualized: PropTypes.bool, | ||
isTree: PropTypes.bool, | ||
onRowClick: PropTypes.func, | ||
onRowContextMenu: PropTypes.func, | ||
onScroll: PropTypes.func, | ||
onSortColumn: PropTypes.func, | ||
onExpandChange: PropTypes.func, | ||
onTouchStart: PropTypes.func, | ||
onTouchMove: PropTypes.func, | ||
onDataUpdated: PropTypes.func | ||
}; | ||
Table.propTypes = propTypes; | ||
Table.defaultProps = { | ||
@@ -1661,0 +1663,0 @@ classPrefix: defaultClassPrefix('table'), |
/** | ||
* Returns an object consisting of props beyond the scope of the Component. | ||
* Useful for getting and spreading unknown props from the user. | ||
* @param {function} Component A function or ReactClass. | ||
* @param {object} propTypes | ||
* @param {object} props A ReactElement props object | ||
* @returns {{}} A shallow copy of the prop object | ||
*/ | ||
var getUnhandledProps = function getUnhandledProps(Component, props) { | ||
var _Component$handledPro = Component.handledProps, | ||
handledProps = _Component$handledPro === void 0 ? [] : _Component$handledPro, | ||
_Component$propTypes = Component.propTypes, | ||
propTypes = _Component$propTypes === void 0 ? {} : _Component$propTypes; | ||
var getUnhandledProps = function getUnhandledProps(propTypes, props) { | ||
var propTypeKeys = Object.keys(propTypes); | ||
@@ -19,6 +15,2 @@ return Object.keys(props).reduce(function (acc, prop) { | ||
if (handledProps.length > 0 && handledProps.indexOf(prop) === -1) { | ||
acc[prop] = props[prop]; | ||
} | ||
if (propTypeKeys.length > 0 && propTypeKeys.indexOf(prop) === -1) { | ||
@@ -25,0 +17,0 @@ acc[prop] = props[prop]; |
@@ -5,2 +5,3 @@ import * as React from 'react'; | ||
import ColumnGroup from '../ColumnGroup'; | ||
import HeaderCell from '../HeaderCell'; | ||
import isNullOrUndefined from './isNullOrUndefined'; | ||
@@ -37,3 +38,8 @@ | ||
nextCellWidth = _nextCell$props.width, | ||
children = _nextCell$props.children; | ||
sortable = _nextCell$props.sortable, | ||
children = _nextCell$props.children, | ||
dataKey = _nextCell$props.dataKey, | ||
onSortColumn = _nextCell$props.onSortColumn, | ||
sortColumn = _nextCell$props.sortColumn, | ||
sortType = _nextCell$props.sortType; | ||
@@ -48,8 +54,11 @@ if (j !== 0) { | ||
groupChildren.push( /*#__PURE__*/React.createElement("div", { | ||
groupChildren.push( /*#__PURE__*/React.createElement(HeaderCell, { | ||
key: j, | ||
style: { | ||
width: nextCellWidth, | ||
left: left | ||
} | ||
left: left, | ||
dataKey: dataKey, | ||
width: nextCellWidth, | ||
sortable: sortable, | ||
sortColumn: sortColumn, | ||
sortType: sortType, | ||
onSortColumn: onSortColumn | ||
}, children)); | ||
@@ -85,4 +94,4 @@ } | ||
_isHeaderCell = _nextCell$props2.isHeaderCell, | ||
dataKey = _nextCell$props2.dataKey; | ||
var cellText = isFunction(_children) ? _children(rowData, rowIndex) : get(rowData, dataKey); | ||
_dataKey = _nextCell$props2.dataKey; | ||
var cellText = isFunction(_children) ? _children(rowData, rowIndex) : get(rowData, _dataKey); | ||
@@ -89,0 +98,0 @@ if (rowData && isNullOrUndefined(cellText) || _isHeaderCell && isNullOrUndefined(_children)) { |
@@ -142,3 +142,3 @@ "use strict"; | ||
_proto.render = function render() { | ||
var _classNames, _styles, _extends2; | ||
var _classNames, _extends2, _contentStyles; | ||
@@ -176,12 +176,12 @@ var _this$props6 = this.props, | ||
var nextHeight = isHeaderCell ? headerHeight : this.getHeight(); | ||
var styles = (_styles = { | ||
var styles = (0, _extends3["default"])({}, style, (_extends2 = { | ||
width: width, | ||
height: nextHeight, | ||
zIndex: depth | ||
}, _styles[rtl ? 'right' : 'left'] = left, _styles); | ||
var contentStyles = (0, _extends3["default"])((_extends2 = { | ||
}, _extends2[rtl ? 'right' : 'left'] = left, _extends2)); | ||
var contentStyles = (_contentStyles = { | ||
width: width, | ||
height: nextHeight, | ||
textAlign: align | ||
}, _extends2[rtl ? 'paddingRight' : 'paddingLeft'] = this.isTreeCol() ? depth * _constants.LAYER_WIDTH + 10 : null, _extends2), style); | ||
}, _contentStyles[rtl ? 'paddingRight' : 'paddingLeft'] = this.isTreeCol() ? depth * _constants.LAYER_WIDTH + 10 : null, _contentStyles); | ||
@@ -200,3 +200,3 @@ if (verticalAlign) { | ||
var unhandledProps = (0, _utils.getUnhandledProps)(Cell, (0, _utils.getUnhandledProps)(_Column["default"], rest)); | ||
var unhandledProps = (0, _utils.getUnhandledProps)(propTypes, (0, _utils.getUnhandledProps)(_Column["default"].propTypes, rest)); | ||
var cell = renderCell ? renderCell(cellContent) : cellContent; | ||
@@ -203,0 +203,0 @@ var content = wordWrap ? /*#__PURE__*/React.createElement("div", { |
@@ -26,2 +26,12 @@ "use strict"; | ||
var propTypes = { | ||
fixed: _propTypes["default"].oneOf(['left', 'right']), | ||
width: _propTypes["default"].number, | ||
height: _propTypes["default"].number, | ||
left: _propTypes["default"].number, | ||
style: _propTypes["default"].object, | ||
className: _propTypes["default"].string, | ||
classPrefix: _propTypes["default"].string | ||
}; | ||
var CellGroup = /*#__PURE__*/function (_React$PureComponent) { | ||
@@ -66,3 +76,3 @@ (0, _inheritsLoose2["default"])(CellGroup, _React$PureComponent); | ||
}, style); | ||
var unhandledProps = (0, _utils.getUnhandledProps)(CellGroup, rest); | ||
var unhandledProps = (0, _utils.getUnhandledProps)(propTypes, rest); | ||
return /*#__PURE__*/React.createElement(_TableContext["default"].Consumer, null, function (_ref) { | ||
@@ -81,11 +91,3 @@ var translateDOMPositionXY = _ref.translateDOMPositionXY; | ||
CellGroup.propTypes = { | ||
fixed: _propTypes["default"].oneOf(['left', 'right']), | ||
width: _propTypes["default"].number, | ||
height: _propTypes["default"].number, | ||
left: _propTypes["default"].number, | ||
style: _propTypes["default"].object, | ||
className: _propTypes["default"].string, | ||
classPrefix: _propTypes["default"].string | ||
}; | ||
CellGroup.propTypes = propTypes; | ||
CellGroup.defaultProps = { | ||
@@ -92,0 +94,0 @@ classPrefix: (0, _utils.defaultClassPrefix)('table-cell-group') |
@@ -52,3 +52,3 @@ "use strict"; | ||
}, header)), React.Children.map(children, function (node) { | ||
var _node$props, _node$props2, _node$props2$style; | ||
var _node$props; | ||
@@ -60,14 +60,9 @@ var nodeStyles = (0, _extends2["default"])({ | ||
}); | ||
var width = (_node$props2 = node.props) === null || _node$props2 === void 0 ? void 0 : (_node$props2$style = _node$props2.style) === null || _node$props2$style === void 0 ? void 0 : _node$props2$style.width; | ||
var nodeContentStyles = { | ||
height: height, | ||
width: width, | ||
verticalAlign: verticalAlign | ||
}; | ||
return /*#__PURE__*/React.cloneElement(node, { | ||
className: addPrefix('cell'), | ||
style: nodeStyles, | ||
children: /*#__PURE__*/React.createElement("div", { | ||
className: addPrefix('cell-content'), | ||
style: nodeContentStyles | ||
headerHeight: height, | ||
verticalAlign: verticalAlign, | ||
children: /*#__PURE__*/React.createElement("span", { | ||
className: addPrefix('cell-content') | ||
}, node.props.children) | ||
@@ -74,0 +69,0 @@ }); |
@@ -30,2 +30,15 @@ "use strict"; | ||
var propTypes = { | ||
height: _propTypes["default"].number, | ||
defaultColumnWidth: _propTypes["default"].number, | ||
columnLeft: _propTypes["default"].number, | ||
columnFixed: _propTypes["default"].oneOfType([_propTypes["default"].bool, _propTypes["default"].oneOf(['left', 'right'])]), | ||
className: _propTypes["default"].string, | ||
classPrefix: _propTypes["default"].string, | ||
style: _propTypes["default"].object, | ||
onColumnResizeStart: _propTypes["default"].func, | ||
onColumnResizeEnd: _propTypes["default"].func, | ||
onColumnResizeMove: _propTypes["default"].func | ||
}; | ||
var ColumnResizeHandler = /*#__PURE__*/function (_React$Component) { | ||
@@ -122,3 +135,3 @@ (0, _inheritsLoose2["default"])(ColumnResizeHandler, _React$Component); | ||
var classes = (0, _classnames["default"])(classPrefix, className); | ||
var unhandled = (0, _utils.getUnhandledProps)(ColumnResizeHandler, rest); | ||
var unhandled = (0, _utils.getUnhandledProps)(propTypes, rest); | ||
return /*#__PURE__*/React.createElement("div", (0, _extends3["default"])({}, unhandled, { | ||
@@ -137,14 +150,3 @@ className: classes, | ||
ColumnResizeHandler.contextType = _TableContext["default"]; | ||
ColumnResizeHandler.propTypes = { | ||
height: _propTypes["default"].number, | ||
defaultColumnWidth: _propTypes["default"].number, | ||
columnLeft: _propTypes["default"].number, | ||
columnFixed: _propTypes["default"].oneOfType([_propTypes["default"].bool, _propTypes["default"].oneOf(['left', 'right'])]), | ||
className: _propTypes["default"].string, | ||
classPrefix: _propTypes["default"].string, | ||
style: _propTypes["default"].object, | ||
onColumnResizeStart: _propTypes["default"].func, | ||
onColumnResizeEnd: _propTypes["default"].func, | ||
onColumnResizeMove: _propTypes["default"].func | ||
}; | ||
ColumnResizeHandler.propTypes = propTypes; | ||
ColumnResizeHandler.defaultProps = { | ||
@@ -151,0 +153,0 @@ classPrefix: (0, _utils.defaultClassPrefix)('table-column-resize-spanner') |
@@ -28,2 +28,18 @@ "use strict"; | ||
var propTypes = { | ||
index: _propTypes["default"].number, | ||
sortColumn: _propTypes["default"].string, | ||
sortType: _propTypes["default"].oneOf(['desc', 'asc']), | ||
sortable: _propTypes["default"].bool, | ||
resizable: _propTypes["default"].bool, | ||
onColumnResizeStart: _propTypes["default"].func, | ||
onColumnResizeEnd: _propTypes["default"].func, | ||
onResize: _propTypes["default"].func, | ||
onColumnResizeMove: _propTypes["default"].func, | ||
onSortColumn: _propTypes["default"].func, | ||
flexGrow: _propTypes["default"].number, | ||
fixed: _propTypes["default"].oneOfType([_propTypes["default"].bool, _propTypes["default"].oneOf(['left', 'right'])]), | ||
children: _propTypes["default"].node | ||
}; | ||
var HeaderCell = /*#__PURE__*/function (_React$PureComponent) { | ||
@@ -125,5 +141,6 @@ (0, _inheritsLoose2["default"])(HeaderCell, _React$PureComponent); | ||
sortType = _this$props5$sortType === void 0 ? '' : _this$props5$sortType, | ||
dataKey = _this$props5.dataKey; | ||
dataKey = _this$props5.dataKey, | ||
groupHeader = _this$props5.groupHeader; | ||
if (sortable) { | ||
if (sortable && !groupHeader) { | ||
var _classNames; | ||
@@ -156,5 +173,6 @@ | ||
sortType = _this$props6.sortType, | ||
rest = (0, _objectWithoutPropertiesLoose2["default"])(_this$props6, ["className", "width", "dataKey", "headerHeight", "children", "left", "sortable", "classPrefix", "sortColumn", "sortType"]); | ||
groupHeader = _this$props6.groupHeader, | ||
rest = (0, _objectWithoutPropertiesLoose2["default"])(_this$props6, ["className", "width", "dataKey", "headerHeight", "children", "left", "sortable", "classPrefix", "sortColumn", "sortType", "groupHeader"]); | ||
var classes = (0, _classnames["default"])(classPrefix, className, (_classNames2 = {}, _classNames2[this.addPrefix('sortable')] = sortable, _classNames2)); | ||
var unhandledProps = (0, _utils.getUnhandledProps)(HeaderCell, rest); | ||
var unhandledProps = (0, _utils.getUnhandledProps)(propTypes, rest); | ||
var ariaSort; | ||
@@ -182,3 +200,3 @@ | ||
isHeaderCell: true, | ||
onClick: this.handleClick | ||
onClick: !groupHeader ? this.handleClick : null | ||
}), children, this.renderSortColumn()), this.renderResizeSpanner()); | ||
@@ -190,17 +208,3 @@ }; | ||
HeaderCell.propTypes = { | ||
index: _propTypes["default"].number, | ||
sortColumn: _propTypes["default"].string, | ||
sortType: _propTypes["default"].oneOf(['desc', 'asc']), | ||
sortable: _propTypes["default"].bool, | ||
resizable: _propTypes["default"].bool, | ||
onColumnResizeStart: _propTypes["default"].func, | ||
onColumnResizeEnd: _propTypes["default"].func, | ||
onResize: _propTypes["default"].func, | ||
onColumnResizeMove: _propTypes["default"].func, | ||
onSortColumn: _propTypes["default"].func, | ||
flexGrow: _propTypes["default"].number, | ||
fixed: _propTypes["default"].oneOfType([_propTypes["default"].bool, _propTypes["default"].oneOf(['left', 'right'])]), | ||
children: _propTypes["default"].node | ||
}; | ||
HeaderCell.propTypes = propTypes; | ||
HeaderCell.defaultProps = { | ||
@@ -207,0 +211,0 @@ classPrefix: (0, _utils.defaultClassPrefix)('table-cell-header') |
@@ -26,2 +26,14 @@ "use strict"; | ||
var propTypes = { | ||
width: _propTypes["default"].number, | ||
height: _propTypes["default"].number, | ||
headerHeight: _propTypes["default"].number, | ||
top: _propTypes["default"].number, | ||
isHeaderRow: _propTypes["default"].bool, | ||
rowRef: _propTypes["default"].oneOfType([_propTypes["default"].func, _propTypes["default"].object]), | ||
className: _propTypes["default"].string, | ||
classPrefix: _propTypes["default"].string, | ||
style: _propTypes["default"].object | ||
}; | ||
var Row = /*#__PURE__*/function (_React$PureComponent) { | ||
@@ -57,3 +69,3 @@ (0, _inheritsLoose2["default"])(Row, _React$PureComponent); | ||
}, style); | ||
var unhandledProps = (0, _utils.getUnhandledProps)(Row, rest); | ||
var unhandledProps = (0, _utils.getUnhandledProps)(propTypes, rest); | ||
return /*#__PURE__*/React.createElement(_TableContext["default"].Consumer, null, function (_ref) { | ||
@@ -75,13 +87,3 @@ var translateDOMPositionXY = _ref.translateDOMPositionXY; | ||
Row.propTypes = { | ||
width: _propTypes["default"].number, | ||
height: _propTypes["default"].number, | ||
headerHeight: _propTypes["default"].number, | ||
top: _propTypes["default"].number, | ||
isHeaderRow: _propTypes["default"].bool, | ||
rowRef: _propTypes["default"].oneOfType([_propTypes["default"].func, _propTypes["default"].object]), | ||
className: _propTypes["default"].string, | ||
classPrefix: _propTypes["default"].string, | ||
style: _propTypes["default"].object | ||
}; | ||
Row.propTypes = propTypes; | ||
Row.defaultProps = { | ||
@@ -88,0 +90,0 @@ classPrefix: (0, _utils.defaultClassPrefix)('table-row'), |
@@ -30,2 +30,13 @@ "use strict"; | ||
var propTypes = { | ||
tableId: _propTypes["default"].string, | ||
vertical: _propTypes["default"].bool, | ||
length: _propTypes["default"].number, | ||
scrollLength: _propTypes["default"].number, | ||
className: _propTypes["default"].string, | ||
classPrefix: _propTypes["default"].string, | ||
onScroll: _propTypes["default"].func, | ||
onMouseDown: _propTypes["default"].func | ||
}; | ||
var Scrollbar = /*#__PURE__*/function (_React$PureComponent) { | ||
@@ -215,3 +226,3 @@ (0, _inheritsLoose2["default"])(Scrollbar, _React$PureComponent); | ||
var styles = (_styles = {}, _styles[vertical ? 'height' : 'width'] = width + "%", _styles[vertical ? 'minHeight' : 'minWidth'] = _constants.SCROLLBAR_MIN_WIDTH, _styles); | ||
var unhandled = (0, _utils.getUnhandledProps)(Scrollbar, rest); | ||
var unhandled = (0, _utils.getUnhandledProps)(propTypes, rest); | ||
var valuenow = this.scrollOffset / length * 100 + width; | ||
@@ -243,12 +254,3 @@ return /*#__PURE__*/React.createElement("div", (0, _extends2["default"])({ | ||
Scrollbar.contextType = _TableContext["default"]; | ||
Scrollbar.propTypes = { | ||
tableId: _propTypes["default"].string, | ||
vertical: _propTypes["default"].bool, | ||
length: _propTypes["default"].number, | ||
scrollLength: _propTypes["default"].number, | ||
className: _propTypes["default"].string, | ||
classPrefix: _propTypes["default"].string, | ||
onScroll: _propTypes["default"].func, | ||
onMouseDown: _propTypes["default"].func | ||
}; | ||
Scrollbar.propTypes = propTypes; | ||
Scrollbar.defaultProps = { | ||
@@ -255,0 +257,0 @@ classPrefix: (0, _utils.defaultClassPrefix)('table-scrollbar'), |
@@ -9,11 +9,7 @@ "use strict"; | ||
* Useful for getting and spreading unknown props from the user. | ||
* @param {function} Component A function or ReactClass. | ||
* @param {object} propTypes | ||
* @param {object} props A ReactElement props object | ||
* @returns {{}} A shallow copy of the prop object | ||
*/ | ||
var getUnhandledProps = function getUnhandledProps(Component, props) { | ||
var _Component$handledPro = Component.handledProps, | ||
handledProps = _Component$handledPro === void 0 ? [] : _Component$handledPro, | ||
_Component$propTypes = Component.propTypes, | ||
propTypes = _Component$propTypes === void 0 ? {} : _Component$propTypes; | ||
var getUnhandledProps = function getUnhandledProps(propTypes, props) { | ||
var propTypeKeys = Object.keys(propTypes); | ||
@@ -25,6 +21,2 @@ return Object.keys(props).reduce(function (acc, prop) { | ||
if (handledProps.length > 0 && handledProps.indexOf(prop) === -1) { | ||
acc[prop] = props[prop]; | ||
} | ||
if (propTypeKeys.length > 0 && propTypeKeys.indexOf(prop) === -1) { | ||
@@ -31,0 +23,0 @@ acc[prop] = props[prop]; |
@@ -18,2 +18,4 @@ "use strict"; | ||
var _HeaderCell = _interopRequireDefault(require("../HeaderCell")); | ||
var _isNullOrUndefined = _interopRequireDefault(require("./isNullOrUndefined")); | ||
@@ -50,3 +52,8 @@ | ||
nextCellWidth = _nextCell$props.width, | ||
children = _nextCell$props.children; | ||
sortable = _nextCell$props.sortable, | ||
children = _nextCell$props.children, | ||
dataKey = _nextCell$props.dataKey, | ||
onSortColumn = _nextCell$props.onSortColumn, | ||
sortColumn = _nextCell$props.sortColumn, | ||
sortType = _nextCell$props.sortType; | ||
@@ -61,8 +68,11 @@ if (j !== 0) { | ||
groupChildren.push( /*#__PURE__*/React.createElement("div", { | ||
groupChildren.push( /*#__PURE__*/React.createElement(_HeaderCell["default"], { | ||
key: j, | ||
style: { | ||
width: nextCellWidth, | ||
left: left | ||
} | ||
left: left, | ||
dataKey: dataKey, | ||
width: nextCellWidth, | ||
sortable: sortable, | ||
sortColumn: sortColumn, | ||
sortType: sortType, | ||
onSortColumn: onSortColumn | ||
}, children)); | ||
@@ -98,4 +108,4 @@ } | ||
_isHeaderCell = _nextCell$props2.isHeaderCell, | ||
dataKey = _nextCell$props2.dataKey; | ||
var cellText = (0, _isFunction["default"])(_children) ? _children(rowData, rowIndex) : (0, _get["default"])(rowData, dataKey); | ||
_dataKey = _nextCell$props2.dataKey; | ||
var cellText = (0, _isFunction["default"])(_children) ? _children(rowData, rowIndex) : (0, _get["default"])(rowData, _dataKey); | ||
@@ -102,0 +112,0 @@ if (rowData && (0, _isNullOrUndefined["default"])(cellText) || _isHeaderCell && (0, _isNullOrUndefined["default"])(_children)) { |
{ | ||
"name": "rsuite-table", | ||
"version": "3.14.6", | ||
"version": "3.15.0", | ||
"description": "A React table component", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -0,5 +1,6 @@ | ||
import PropTypes from 'prop-types'; | ||
/** | ||
* Returns an object consisting of props beyond the scope of the Component. | ||
* Useful for getting and spreading unknown props from the user. | ||
* @param {function} Component A function or ReactClass. | ||
* @param {object} propTypes | ||
* @param {object} props A ReactElement props object | ||
@@ -9,4 +10,6 @@ * @returns {{}} A shallow copy of the prop object | ||
const getUnhandledProps = (Component: any, props: any) => { | ||
const { handledProps = [], propTypes = {} } = Component; | ||
const getUnhandledProps = ( | ||
propTypes: Record<string, PropTypes.Requireable<any>>, | ||
props: Record<string, any> | ||
) => { | ||
const propTypeKeys = Object.keys(propTypes); | ||
@@ -18,5 +21,2 @@ | ||
} | ||
if (handledProps.length > 0 && handledProps.indexOf(prop) === -1) { | ||
acc[prop] = props[prop]; | ||
} | ||
if (propTypeKeys.length > 0 && propTypeKeys.indexOf(prop) === -1) { | ||
@@ -23,0 +23,0 @@ acc[prop] = props[prop]; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
429841
9202