feat: update rc-trigger
parent
ce07ea33de
commit
1848a5e47c
|
@ -94,7 +94,13 @@ export default {
|
||||||
} else {
|
} else {
|
||||||
popupVisible = !!props.defaultPopupVisible;
|
popupVisible = !!props.defaultPopupVisible;
|
||||||
}
|
}
|
||||||
|
ALL_HANDLERS.forEach(h => {
|
||||||
|
this[`fire${h}`] = e => {
|
||||||
|
this.fireEvents(h, e);
|
||||||
|
};
|
||||||
|
});
|
||||||
return {
|
return {
|
||||||
|
prevPopupVisible: popupVisible,
|
||||||
sPopupVisible: popupVisible,
|
sPopupVisible: popupVisible,
|
||||||
point: null,
|
point: null,
|
||||||
};
|
};
|
||||||
|
@ -103,6 +109,7 @@ export default {
|
||||||
popupVisible(val) {
|
popupVisible(val) {
|
||||||
if (val !== undefined) {
|
if (val !== undefined) {
|
||||||
this.sPopupVisible = val;
|
this.sPopupVisible = val;
|
||||||
|
this.prevPopupVisible = val;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
sPopupVisible(val) {
|
sPopupVisible(val) {
|
||||||
|
@ -113,14 +120,6 @@ export default {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
beforeCreate() {
|
|
||||||
ALL_HANDLERS.forEach(h => {
|
|
||||||
this[`fire${h}`] = e => {
|
|
||||||
this.fireEvents(h, e);
|
|
||||||
};
|
|
||||||
});
|
|
||||||
},
|
|
||||||
deactivated() {
|
deactivated() {
|
||||||
this.setPopupVisible(false);
|
this.setPopupVisible(false);
|
||||||
},
|
},
|
||||||
|
@ -286,7 +285,15 @@ export default {
|
||||||
}
|
}
|
||||||
this.preClickTime = 0;
|
this.preClickTime = 0;
|
||||||
this.preTouchTime = 0;
|
this.preTouchTime = 0;
|
||||||
if (event && event.preventDefault) {
|
// Only prevent default when all the action is click.
|
||||||
|
// https://github.com/ant-design/ant-design/issues/17043
|
||||||
|
// https://github.com/ant-design/ant-design/issues/17291
|
||||||
|
if (
|
||||||
|
this.isClickToShow() &&
|
||||||
|
(this.isClickToHide() || this.isBlurToHide()) &&
|
||||||
|
event &&
|
||||||
|
event.preventDefault
|
||||||
|
) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
if (event && event.domEvent) {
|
if (event && event.domEvent) {
|
||||||
|
@ -446,19 +453,20 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
setPopupVisible(sPopupVisible, event) {
|
setPopupVisible(sPopupVisible, event) {
|
||||||
const { alignPoint } = this.$props;
|
const { alignPoint, sPopupVisible: prevPopupVisible } = this;
|
||||||
this.clearDelayTimer();
|
this.clearDelayTimer();
|
||||||
if (this.$data.sPopupVisible !== sPopupVisible) {
|
if (prevPopupVisible !== sPopupVisible) {
|
||||||
if (!hasProp(this, 'popupVisible')) {
|
if (!hasProp(this, 'popupVisible')) {
|
||||||
this.setState({
|
this.setState({
|
||||||
sPopupVisible,
|
sPopupVisible,
|
||||||
|
prevPopupVisible,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
const listeners = getListeners(this);
|
const listeners = getListeners(this);
|
||||||
listeners.popupVisibleChange && listeners.popupVisibleChange(sPopupVisible);
|
listeners.popupVisibleChange && listeners.popupVisibleChange(sPopupVisible);
|
||||||
}
|
}
|
||||||
// Always record the point position since mouseEnterDelay will delay the show
|
// Always record the point position since mouseEnterDelay will delay the show
|
||||||
if (sPopupVisible && alignPoint && event) {
|
if (alignPoint && event) {
|
||||||
this.setPoint(event);
|
this.setPoint(event);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
// based on rc-trigger 2.6.2
|
// based on rc-trigger 2.6.5
|
||||||
import Trigger from './Trigger';
|
import Trigger from './Trigger';
|
||||||
export default Trigger;
|
export default Trigger;
|
||||||
|
|
Loading…
Reference in New Issue