diff --git a/README.md b/README.md index 985959c..7e132c9 100644 --- a/README.md +++ b/README.md @@ -117,6 +117,12 @@ ReactDOM.render(collapse, container); specific the custom expand icon. + + collapsible + Boolean | 'header' + true + specify whether the panel of children is collapsible or the area of collapsible. + @@ -194,9 +200,17 @@ If `accordion` is true, only one panel can be open. Opening another panel will Content to render in the right of the panel header + + collapsible + Boolean | 'header' + true + specify whether the panel be collapsible or the area of collapsible. + +> `disabled` is removed since 3.0.0, please use `collapsible=false` replace it. + #### key If `key` is not provided, the panel's index will be used instead. diff --git a/assets/index.less b/assets/index.less index 3154658..d123a22 100644 --- a/assets/index.less +++ b/assets/index.less @@ -59,7 +59,7 @@ margin: 0 16px 0 auto; } } - .@{prefixCls}-header-collapsable-only { + .@{prefixCls}-header-collapsible-only { cursor: default; .@{prefixCls}-header-text { cursor: pointer; diff --git a/examples/simple.tsx b/examples/simple.tsx index 25cf018..8ad7be3 100644 --- a/examples/simple.tsx +++ b/examples/simple.tsx @@ -18,7 +18,7 @@ class Test extends React.Component { time: random(), accordion: false, activeKey: ['4'], - headerCollapsableOnly: false, + collapsible: true, }; onChange = (activeKey: string) => { @@ -33,7 +33,11 @@ class Test extends React.Component { for (let i = 0, len = 3; i < len; i++) { const key = i + 1; items.push( - +

{text.repeat(this.state.time)}

, ); @@ -89,19 +93,16 @@ class Test extends React.Component { }); }; - toggleHeaderCollapsableOnly = () => { - const { headerCollapsableOnly } = this.state; + handleCollapsibleChange = (e: any) => { + const values = [true, 'header', false]; this.setState({ - headerCollapsableOnly: !headerCollapsableOnly, + collapsible: values[e.target.value], }); }; render() { - const { accordion, activeKey, headerCollapsableOnly } = this.state; + const { accordion, activeKey, collapsible } = this.state; const btn = accordion ? 'Mode: accordion' : 'Mode: collapse'; - const headerCollapsableOnlyBtn = headerCollapsableOnly - ? 'headerCollapsableOnly: true' - : 'headerCollapsableOnly: false'; return (
- +

+ collapsible: + +