rc-trigger
Advanced tools
Comparing version 1.9.1 to 1.10.0
@@ -49,3 +49,4 @@ 'use strict'; | ||
var ALL_HANDLERS = ['onClick', 'onMouseDown', 'onTouchStart', 'onMouseEnter', 'onMouseLeave', 'onFocus', 'onBlur']; | ||
// use fastclick for mobile touch | ||
var ALL_HANDLERS = ['onClick', 'onMouseDown', 'onMouseEnter', 'onMouseLeave', 'onFocus', 'onBlur']; | ||
@@ -69,3 +70,3 @@ var Trigger = _react2["default"].createClass({ | ||
builtinPlacements: _react.PropTypes.object, | ||
popupTransitionName: _react.PropTypes.string, | ||
popupTransitionName: _react.PropTypes.oneOfType([_react.PropTypes.string, _react.PropTypes.object]), | ||
popupAnimation: _react.PropTypes.any, | ||
@@ -85,3 +86,3 @@ mouseEnterDelay: _react.PropTypes.number, | ||
popupVisible: _react.PropTypes.bool, | ||
maskTransitionName: _react.PropTypes.string, | ||
maskTransitionName: _react.PropTypes.oneOfType([_react.PropTypes.string, _react.PropTypes.object]), | ||
maskAnimation: _react.PropTypes.string | ||
@@ -184,9 +185,4 @@ }, | ||
currentDocument = props.getDocument(); | ||
this.clickOutsideHandler = (0, _addEventListener2["default"])(currentDocument, 'mousedown', this.onDocumentClick); | ||
this.clickOutsideHandler = (0, _addEventListener2["default"])(currentDocument, 'click', this.onDocumentClick); | ||
} | ||
// always hide on mobile | ||
if (!this.touchOutsideHandler) { | ||
currentDocument = currentDocument || props.getDocument(); | ||
this.touchOutsideHandler = (0, _addEventListener2["default"])(currentDocument, 'touchstart', this.onDocumentClick); | ||
} | ||
return; | ||
@@ -233,6 +229,2 @@ } | ||
}, | ||
onTouchStart: function onTouchStart(e) { | ||
this.fireEvents('onTouchStart', e); | ||
this.preTouchTime = Date.now(); | ||
}, | ||
onBlur: function onBlur(e) { | ||
@@ -250,8 +242,4 @@ this.fireEvents('onBlur', e); | ||
var preTime = void 0; | ||
if (this.preClickTime && this.preTouchTime) { | ||
preTime = Math.min(this.preClickTime, this.preTouchTime); | ||
} else if (this.preClickTime) { | ||
if (this.preClickTime) { | ||
preTime = this.preClickTime; | ||
} else if (this.preTouchTime) { | ||
preTime = this.preTouchTime; | ||
} | ||
@@ -264,3 +252,2 @@ if (Math.abs(preTime - this.focusTime) < 20) { | ||
this.preClickTime = 0; | ||
this.preTouchTime = 0; | ||
event.preventDefault(); | ||
@@ -390,7 +377,2 @@ var nextVisible = !this.state.popupVisible; | ||
} | ||
if (this.touchOutsideHandler) { | ||
this.touchOutsideHandler.remove(); | ||
this.touchOutsideHandler = null; | ||
} | ||
}, | ||
@@ -473,7 +455,5 @@ createTwoChains: function createTwoChains(event) { | ||
newChildProps.onMouseDown = this.onMouseDown; | ||
newChildProps.onTouchStart = this.onTouchStart; | ||
} else { | ||
newChildProps.onClick = this.createTwoChains('onClick'); | ||
newChildProps.onMouseDown = this.createTwoChains('onMouseDown'); | ||
newChildProps.onTouchStart = this.createTwoChains('onTouchStart'); | ||
} | ||
@@ -480,0 +460,0 @@ if (this.isMouseEnterToShow()) { |
{ | ||
"name": "rc-trigger", | ||
"version": "1.9.1", | ||
"version": "1.10.0", | ||
"description": "base abstract trigger component for react", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
41431
928