11import React from 'react' ;
2+ import PropTypes from 'prop-types' ;
23import { connect } from 'mini-store' ;
34import ExpandIcon from './ExpandIcon' ;
45
56class ExpandableRow extends React . Component {
7+ static propTypes = {
8+ prefixCls : PropTypes . string . isRequired ,
9+ rowKey : PropTypes . oneOfType ( [
10+ PropTypes . string ,
11+ PropTypes . number ,
12+ ] ) . isRequired ,
13+ fixed : PropTypes . oneOfType ( [
14+ PropTypes . string ,
15+ PropTypes . bool ,
16+ ] ) ,
17+ record : PropTypes . object . isRequired ,
18+ indentSize : PropTypes . number ,
19+ needIndentSpaced : PropTypes . bool . isRequired ,
20+ expandRowByClick : PropTypes . bool ,
21+ expanded : PropTypes . bool . isRequired ,
22+ expandIconAsCell : PropTypes . bool ,
23+ expandIconColumnIndex : PropTypes . number ,
24+ childrenColumnName : PropTypes . string ,
25+ expandedRowRender : PropTypes . func ,
26+ onExpandedChange : PropTypes . func . isRequired ,
27+ onRowClick : PropTypes . func ,
28+ children : PropTypes . func . isRequired ,
29+ }
30+
631 componentWillUnmount ( ) {
732 this . handleDestroy ( ) ;
833 }
934
1035 hasExpandIcon = ( columnIndex ) => {
1136 const { expandRowByClick } = this . props ;
12- return ! this . expandIconAsCell && ! expandRowByClick && columnIndex === this . expandIconColumnIndex ;
37+ return ! this . expandIconAsCell &&
38+ ! expandRowByClick &&
39+ columnIndex === this . expandIconColumnIndex ;
1340 }
1441
1542 handleExpandChange = ( record , event ) => {
@@ -35,7 +62,7 @@ class ExpandableRow extends React.Component {
3562 }
3663
3764 renderExpandIcon = ( ) => {
38- const { prefixCls, expanded, record, needIndentSpaced, onExpandedChange } = this . props ;
65+ const { prefixCls, expanded, record, needIndentSpaced } = this . props ;
3966
4067 return (
4168 < ExpandIcon
@@ -85,7 +112,7 @@ class ExpandableRow extends React.Component {
85112 hasExpandIcon : this . hasExpandIcon ,
86113 renderExpandIcon : this . renderExpandIcon ,
87114 renderExpandIconCell : this . renderExpandIconCell ,
88- }
115+ } ;
89116
90117 return this . props . children ( expandableRowProps ) ;
91118 }
@@ -94,4 +121,3 @@ class ExpandableRow extends React.Component {
94121export default connect ( ( { expandedRowKeys } , { rowKey } ) => ( {
95122 expanded : ! ! ~ expandedRowKeys . indexOf ( rowKey ) ,
96123} ) ) ( ExpandableRow ) ;
97-
0 commit comments