1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-10 11:21:29 +00:00

remove react old defaultProps (#7576)

This commit is contained in:
Michael An
2025-03-10 14:27:08 +08:00
committed by GitHub
parent 00707d1d05
commit 55719ccbdf
43 changed files with 214 additions and 438 deletions

View File

@@ -34,7 +34,7 @@ class CustomizePopover extends React.Component {
}
onKeyDown = (e) => {
const { canHidePopover, hidePopoverWithEsc } = this.props;
const { canHidePopover = true, hidePopoverWithEsc } = this.props;
if (e.keyCode === KeyCodes.Escape && typeof hidePopoverWithEsc === 'function' && !this.isSelectOpen) {
e.preventDefault();
hidePopoverWithEsc();
@@ -46,7 +46,8 @@ class CustomizePopover extends React.Component {
};
onMouseDown = (e) => {
if (!this.props.canHidePopover) return;
const { canHidePopover = true } = this.props;
if (!canHidePopover) return;
if (this.popoverRef && e && getEventClassName(e).indexOf('popover') === -1 && !this.popoverRef.contains(e.target)) {
this.props.hidePopover(e);
}
@@ -58,8 +59,8 @@ class CustomizePopover extends React.Component {
render() {
const {
target, boundariesElement, innerClassName, popoverClassName, hideArrow, modifiers,
placement,
target, boundariesElement, innerClassName, popoverClassName, hideArrow = true, modifiers,
placement = 'bottom-start',
} = this.props;
let additionalProps = {};
if (boundariesElement) {
@@ -85,12 +86,6 @@ class CustomizePopover extends React.Component {
}
}
CustomizePopover.defaultProps = {
placement: 'bottom-start',
hideArrow: true,
canHidePopover: true
};
CustomizePopover.propTypes = propTypes;
export default CustomizePopover;