@@ -54,11 +54,10 @@ class CollapsePanel extends React.Component<CollapsePanelProps, any> {
5454 } = this . props ;
5555
5656 const disabled = collapsible === 'disabled' ;
57- const collapsibleHeader = collapsible === 'header' ;
5857
5958 const headerCls = classNames ( `${ prefixCls } -header` , {
6059 [ headerClass ] : headerClass ,
61- [ `${ prefixCls } -header-collapsible-only` ] : collapsibleHeader ,
60+ [ `${ prefixCls } -header-collapsible-only` ] : collapsible === 'header' ,
6261 } ) ;
6362 const itemCls = classNames (
6463 {
@@ -70,36 +69,24 @@ class CollapsePanel extends React.Component<CollapsePanelProps, any> {
7069 ) ;
7170
7271 let icon : any = < i className = "arrow" /> ;
73-
74- /** header 节点属性 */
75- const headerProps : React . HTMLAttributes < HTMLDivElement > = {
76- className : headerCls ,
77- 'aria-expanded' : isActive ,
78- onKeyPress : this . handleKeyPress ,
79- } ;
80-
8172 if ( showArrow && typeof expandIcon === 'function' ) {
8273 icon = expandIcon ( this . props ) ;
8374 }
84- if ( collapsibleHeader ) {
85- icon = (
86- < span style = { { cursor : 'pointer' } } onClick = { ( ) => this . handleItemClick ( ) } >
87- { icon }
88- </ span >
89- ) ;
90- } else {
91- headerProps . onClick = this . handleItemClick ;
92- headerProps . role = accordion ? 'tab' : 'button' ;
93- headerProps . tabIndex = disabled ? - 1 : 0 ;
94- }
9575
9676 const ifExtraExist = extra !== null && extra !== undefined && typeof extra !== 'boolean' ;
9777
9878 return (
9979 < div className = { itemCls } style = { style } id = { id } >
100- < div { ...headerProps } >
80+ < div
81+ className = { headerCls }
82+ onClick = { ( ) => collapsible !== 'header' && this . handleItemClick ( ) }
83+ role = { accordion ? 'tab' : 'button' }
84+ tabIndex = { disabled ? - 1 : 0 }
85+ aria-expanded = { isActive }
86+ onKeyPress = { this . handleKeyPress }
87+ >
10188 { showArrow && icon }
102- { collapsibleHeader ? (
89+ { collapsible === 'header' ? (
10390 < span onClick = { this . handleItemClick } className = { `${ prefixCls } -header-text` } >
10491 { header }
10592 </ span >
0 commit comments