Skip to content

Commit

Permalink
fix: support getPopupContainer for vertical scroll issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Howard.Zuo committed Oct 28, 2018
1 parent d7d1c71 commit 91a42b3
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 3 deletions.
6 changes: 6 additions & 0 deletions example/src/Document/Routes/Components/RegionPicker2Doc.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class RegionPicker2Doc extends Component {
<RegionPicker2
placeholder={Placeholder}
disabled={Disabled}
getPopupContainer={GetPopupContainer}
defaultConstructLevel={DefaultConstructLevel}
dataRetriever={DataRetriever}
value={Value}
Expand Down Expand Up @@ -83,6 +84,11 @@ class RegionPicker2Doc extends Component {
type: 'Boolean',
description: '是否禁用该组件'
},
{
prop: 'getPopupContainer',
type: 'Function(node: HTMLElement) => HTMLElement',
description: '默认值:() => document.body'
},
{
prop: 'value',
type: 'Object',
Expand Down
6 changes: 6 additions & 0 deletions example/src/Document/Routes/Components/RegionPickerDoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ class RegionPickerDoc extends Component {
placeholders={Placeholders}
showLines={ShowLines}
showDistrict={ShowDistrict}
getPopupContainer={GetPopupContainer}
disabled={Disabled}
dataRetriever={DataRetriever}
value={Value}
Expand Down Expand Up @@ -103,6 +104,11 @@ class RegionPickerDoc extends Component {
type: 'Boolean',
description: '是否禁用该组件'
},
{
prop: 'getPopupContainer',
type: 'Function(node: HTMLElement) => HTMLElement',
description: '默认值:() => document.body'
},
{
prop: 'value',
type: 'Object',
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "antd-extensions",
"version": "1.5.1",
"version": "1.5.2",
"description": "",
"author": "leftstick",
"license": "MIT",
Expand Down
7 changes: 6 additions & 1 deletion src/exts/RegionPicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class RegionPicker extends Component {
noData: PropTypes.string
}),
showDistrict: PropTypes.bool,
getPopupContainer: PropTypes.func,
disabled: PropTypes.bool,
showLines: PropTypes.oneOf([1, 2, 3, 4]),
dataRetriever: PropTypes.func,
Expand Down Expand Up @@ -238,7 +239,7 @@ class RegionPicker extends Component {
}

render() {
const { placeholders, showDistrict, showLines, disabled } = this.props
const { placeholders, showDistrict, showLines, disabled, getPopupContainer } = this.props

const finalPlaceholders = Object.assign({}, DEFAULT_PLACEHOLDERS, placeholders)
return (
Expand All @@ -253,6 +254,7 @@ class RegionPicker extends Component {
<Select
disabled={disabled}
value={this.state.countryValue}
getPopupContainer={getPopupContainer}
showSearch
style={getStyleForSelect(1, showLines, showDistrict)}
placeholder={finalPlaceholders.country}
Expand All @@ -271,6 +273,7 @@ class RegionPicker extends Component {
<Select
disabled={disabled}
value={this.state.stateValue}
getPopupContainer={getPopupContainer}
showSearch
style={getStyleForSelect(2, showLines, showDistrict)}
placeholder={finalPlaceholders.state}
Expand All @@ -289,6 +292,7 @@ class RegionPicker extends Component {
<Select
disabled={disabled}
value={this.state.cityValue}
getPopupContainer={getPopupContainer}
showSearch
style={getStyleForSelect(3, showLines, showDistrict)}
placeholder={finalPlaceholders.city}
Expand All @@ -308,6 +312,7 @@ class RegionPicker extends Component {
<Select
disabled={disabled}
value={this.state.districtValue}
getPopupContainer={getPopupContainer}
showSearch
style={BASE_SELECT_STYLE}
placeholder={finalPlaceholders.district}
Expand Down
4 changes: 3 additions & 1 deletion src/exts/RegionPicker2.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class RegionPicker2 extends Component {
style: PropTypes.object,
placeholder: PropTypes.string,
disabled: PropTypes.bool,
getPopupContainer: PropTypes.func,
defaultConstructLevel: PropTypes.oneOf([1, 2, 3, 4]),
dataRetriever: PropTypes.func,
onChange: PropTypes.func,
Expand Down Expand Up @@ -199,10 +200,11 @@ class RegionPicker2 extends Component {
}

render() {
const { className, style, placeholder, disabled } = this.props
const { className, style, placeholder, disabled, getPopupContainer } = this.props
const { options, internalVal } = this.state
return (
<Cascader
getPopupContainer={getPopupContainer}
disabled={disabled}
className={className}
style={style}
Expand Down

0 comments on commit 91a42b3

Please sign in to comment.