Skip to content

Commit 3b797e1

Browse files
author
JH
committed
Fix department single select editor render position.
1 parent 669d2c4 commit 3b797e1

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

  • src/DepartmentSingleSelectEditor/pc-editor

src/DepartmentSingleSelectEditor/pc-editor/index.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,15 @@ class PCDepartmentSingleSelectEditor extends Component {
3535

3636
componentDidMount() {
3737
if (this.isRowExpand) {
38-
if (this.outerRef.getBoundingClientRect().top > 330) {
39-
const menuStyle = { top: -200 };
40-
this.setState({ menuStyle });
38+
let menuStyle = {};
39+
const { top, left } = this.outerRef.getBoundingClientRect();
40+
if (top > 330) {
41+
menuStyle.top = -200;
4142
}
43+
if (left > window.innerWidth - 300) {
44+
menuStyle.left = left - window.innerWidth;
45+
}
46+
this.setState({ menuStyle });
4247
}
4348
}
4449

0 commit comments

Comments
 (0)