react-base-table
Advanced tools
Comparing version 1.7.1 to 1.7.2
@@ -5,2 +5,8 @@ # CHANGELOG | ||
## v1.7.2 (2019-08-26) | ||
- fix: custom renderers should support function component with hooks | ||
## v1.7.1 (2019-08-22) | ||
- fix: `scrollToRow` doesn't work regression introduced in #73 | ||
@@ -7,0 +13,0 @@ |
@@ -1157,3 +1157,3 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose"; | ||
*/ | ||
overlayRenderer: PropTypes.oneOfType([PropTypes.func, PropTypes.element]), | ||
overlayRenderer: PropTypes.oneOfType([PropTypes.elementType, PropTypes.element]), | ||
@@ -1163,3 +1163,3 @@ /** | ||
*/ | ||
emptyRenderer: PropTypes.oneOfType([PropTypes.func, PropTypes.element]), | ||
emptyRenderer: PropTypes.oneOfType([PropTypes.elementType, PropTypes.element]), | ||
@@ -1169,3 +1169,3 @@ /** | ||
*/ | ||
footerRenderer: PropTypes.oneOfType([PropTypes.func, PropTypes.element]), | ||
footerRenderer: PropTypes.oneOfType([PropTypes.elementType, PropTypes.element]), | ||
@@ -1176,3 +1176,3 @@ /** | ||
*/ | ||
headerRenderer: PropTypes.oneOfType([PropTypes.func, PropTypes.element]), | ||
headerRenderer: PropTypes.oneOfType([PropTypes.elementType, PropTypes.element]), | ||
@@ -1183,3 +1183,3 @@ /** | ||
*/ | ||
rowRenderer: PropTypes.oneOfType([PropTypes.func, PropTypes.element]), | ||
rowRenderer: PropTypes.oneOfType([PropTypes.elementType, PropTypes.element]), | ||
@@ -1186,0 +1186,0 @@ /** |
@@ -119,3 +119,3 @@ import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose"; | ||
*/ | ||
cellRenderer: PropTypes.oneOfType([PropTypes.func, PropTypes.element]), | ||
cellRenderer: PropTypes.oneOfType([PropTypes.elementType, PropTypes.element]), | ||
@@ -126,3 +126,3 @@ /** | ||
*/ | ||
headerRenderer: PropTypes.oneOfType([PropTypes.func, PropTypes.element]) | ||
headerRenderer: PropTypes.oneOfType([PropTypes.elementType, PropTypes.element]) | ||
}; | ||
@@ -129,0 +129,0 @@ Column.Alignment = Alignment; |
@@ -56,3 +56,3 @@ import _extends from "@babel/runtime/helpers/extends"; | ||
cellRenderer: PropTypes.func, | ||
headerRenderer: PropTypes.oneOfType([PropTypes.func, PropTypes.element]), | ||
headerRenderer: PropTypes.oneOfType([PropTypes.elementType, PropTypes.element]), | ||
expandColumnKey: PropTypes.string, | ||
@@ -59,0 +59,0 @@ expandIcon: PropTypes.func, |
@@ -175,3 +175,3 @@ import _extends from "@babel/runtime/helpers/extends"; | ||
rowEventHandlers: PropTypes.object, | ||
rowRenderer: PropTypes.oneOfType([PropTypes.func, PropTypes.element]), | ||
rowRenderer: PropTypes.oneOfType([PropTypes.elementType, PropTypes.element]), | ||
cellRenderer: PropTypes.func, | ||
@@ -178,0 +178,0 @@ expandIconRenderer: PropTypes.func, |
import _objectSpread from "@babel/runtime/helpers/objectSpread"; | ||
import React from 'react'; | ||
export function renderElement(renderer, props) { | ||
if (!renderer) return null; | ||
if (React.isValidElement(renderer)) { | ||
return React.cloneElement(renderer, props); | ||
} else if (typeof renderer === 'function') { | ||
if (renderer.prototype && renderer.prototype.isReactComponent) { | ||
return React.createElement(renderer, props); | ||
} else if (renderer.defaultProps) { | ||
return renderer(_objectSpread({}, renderer.defaultProps, props)); | ||
} | ||
return renderer(props); | ||
} else { | ||
return null; | ||
return React.createElement(renderer, props); | ||
} | ||
@@ -17,0 +11,0 @@ } |
@@ -1235,3 +1235,3 @@ "use strict"; | ||
*/ | ||
overlayRenderer: _propTypes["default"].oneOfType([_propTypes["default"].func, _propTypes["default"].element]), | ||
overlayRenderer: _propTypes["default"].oneOfType([_propTypes["default"].elementType, _propTypes["default"].element]), | ||
@@ -1241,3 +1241,3 @@ /** | ||
*/ | ||
emptyRenderer: _propTypes["default"].oneOfType([_propTypes["default"].func, _propTypes["default"].element]), | ||
emptyRenderer: _propTypes["default"].oneOfType([_propTypes["default"].elementType, _propTypes["default"].element]), | ||
@@ -1247,3 +1247,3 @@ /** | ||
*/ | ||
footerRenderer: _propTypes["default"].oneOfType([_propTypes["default"].func, _propTypes["default"].element]), | ||
footerRenderer: _propTypes["default"].oneOfType([_propTypes["default"].elementType, _propTypes["default"].element]), | ||
@@ -1254,3 +1254,3 @@ /** | ||
*/ | ||
headerRenderer: _propTypes["default"].oneOfType([_propTypes["default"].func, _propTypes["default"].element]), | ||
headerRenderer: _propTypes["default"].oneOfType([_propTypes["default"].elementType, _propTypes["default"].element]), | ||
@@ -1261,3 +1261,3 @@ /** | ||
*/ | ||
rowRenderer: _propTypes["default"].oneOfType([_propTypes["default"].func, _propTypes["default"].element]), | ||
rowRenderer: _propTypes["default"].oneOfType([_propTypes["default"].elementType, _propTypes["default"].element]), | ||
@@ -1264,0 +1264,0 @@ /** |
@@ -141,3 +141,3 @@ "use strict"; | ||
*/ | ||
cellRenderer: _propTypes["default"].oneOfType([_propTypes["default"].func, _propTypes["default"].element]), | ||
cellRenderer: _propTypes["default"].oneOfType([_propTypes["default"].elementType, _propTypes["default"].element]), | ||
@@ -148,3 +148,3 @@ /** | ||
*/ | ||
headerRenderer: _propTypes["default"].oneOfType([_propTypes["default"].func, _propTypes["default"].element]) | ||
headerRenderer: _propTypes["default"].oneOfType([_propTypes["default"].elementType, _propTypes["default"].element]) | ||
}; | ||
@@ -151,0 +151,0 @@ Column.Alignment = Alignment; |
@@ -68,3 +68,3 @@ "use strict"; | ||
cellRenderer: _propTypes["default"].func, | ||
headerRenderer: _propTypes["default"].oneOfType([_propTypes["default"].func, _propTypes["default"].element]), | ||
headerRenderer: _propTypes["default"].oneOfType([_propTypes["default"].elementType, _propTypes["default"].element]), | ||
expandColumnKey: _propTypes["default"].string, | ||
@@ -71,0 +71,0 @@ expandIcon: _propTypes["default"].func, |
@@ -197,3 +197,3 @@ "use strict"; | ||
rowEventHandlers: _propTypes["default"].object, | ||
rowRenderer: _propTypes["default"].oneOfType([_propTypes["default"].func, _propTypes["default"].element]), | ||
rowRenderer: _propTypes["default"].oneOfType([_propTypes["default"].elementType, _propTypes["default"].element]), | ||
cellRenderer: _propTypes["default"].func, | ||
@@ -200,0 +200,0 @@ expandIconRenderer: _propTypes["default"].func, |
@@ -31,14 +31,8 @@ "use strict"; | ||
function renderElement(renderer, props) { | ||
if (!renderer) return null; | ||
if (_react["default"].isValidElement(renderer)) { | ||
return _react["default"].cloneElement(renderer, props); | ||
} else if (typeof renderer === 'function') { | ||
if (renderer.prototype && renderer.prototype.isReactComponent) { | ||
return _react["default"].createElement(renderer, props); | ||
} else if (renderer.defaultProps) { | ||
return renderer((0, _objectSpread2["default"])({}, renderer.defaultProps, props)); | ||
} | ||
return renderer(props); | ||
} else { | ||
return null; | ||
return _react["default"].createElement(renderer, props); | ||
} | ||
@@ -45,0 +39,0 @@ } |
{ | ||
"name": "react-base-table", | ||
"version": "1.7.1", | ||
"version": "1.7.2", | ||
"description": "a react table component to display large data set with high performance and flexibility", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
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
816793
6144