rc-trigger
Advanced tools
Comparing version 1.8.3 to 1.8.4
# History | ||
---- | ||
## 1.9.0 / 2017-02-27 | ||
- add getDocument prop | ||
## 1.8.2 / 2017-02-24 | ||
@@ -5,0 +9,0 @@ |
@@ -7,6 +7,2 @@ 'use strict'; | ||
var _objectWithoutProperties2 = require('babel-runtime/helpers/objectWithoutProperties'); | ||
var _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2); | ||
var _react = require('react'); | ||
@@ -18,2 +14,4 @@ | ||
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } | ||
var LazyRenderBox = _react2["default"].createClass({ | ||
@@ -35,5 +33,4 @@ displayName: 'LazyRenderBox', | ||
visible = _props.visible, | ||
props = (0, _objectWithoutProperties3["default"])(_props, ['hiddenClassName', 'visible']); | ||
props = _objectWithoutProperties(_props, ['hiddenClassName', 'visible']); | ||
if (hiddenClassName || _react2["default"].Children.count(props.children) > 1) { | ||
@@ -40,0 +37,0 @@ if (!visible && hiddenClassName) { |
@@ -7,6 +7,4 @@ 'use strict'; | ||
var _extends2 = require('babel-runtime/helpers/extends'); | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
var _extends3 = _interopRequireDefault(_extends2); | ||
var _react = require('react'); | ||
@@ -107,3 +105,3 @@ | ||
} | ||
var newStyle = (0, _extends3["default"])({}, style, this.getZIndexStyle()); | ||
var newStyle = _extends({}, style, this.getZIndexStyle()); | ||
var popupInnerProps = { | ||
@@ -138,3 +136,3 @@ className: className, | ||
_PopupInner2["default"], | ||
(0, _extends3["default"])({ | ||
_extends({ | ||
visible: true | ||
@@ -171,3 +169,3 @@ }, popupInnerProps), | ||
_PopupInner2["default"], | ||
(0, _extends3["default"])({ | ||
_extends({ | ||
hiddenClassName: hiddenClassName | ||
@@ -174,0 +172,0 @@ }, popupInnerProps), |
@@ -7,6 +7,4 @@ 'use strict'; | ||
var _extends2 = require('babel-runtime/helpers/extends'); | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
var _extends3 = _interopRequireDefault(_extends2); | ||
var _react = require('react'); | ||
@@ -46,2 +44,6 @@ | ||
function returnDocument() { | ||
return window.document; | ||
} | ||
var ALL_HANDLERS = ['onClick', 'onMouseDown', 'onTouchStart', 'onMouseEnter', 'onMouseLeave', 'onFocus', 'onBlur']; | ||
@@ -74,2 +76,3 @@ | ||
getPopupContainer: _react.PropTypes.func, | ||
getDocument: _react.PropTypes.func, | ||
destroyPopupOnHide: _react.PropTypes.bool, | ||
@@ -92,10 +95,6 @@ mask: _react.PropTypes.bool, | ||
getContainer: function getContainer(instance) { | ||
var props = instance.props; | ||
var popupContainer = document.createElement('div'); | ||
// Make sure default popup container will never cause scrollbar appearing | ||
// https://github.com/react-component/trigger/issues/41 | ||
popupContainer.style.position = 'absolute'; | ||
popupContainer.style.top = '0'; | ||
popupContainer.style.left = '0'; | ||
popupContainer.style.width = '100%'; | ||
var mountNode = instance.props.getPopupContainer ? instance.props.getPopupContainer((0, _reactDom.findDOMNode)(instance)) : document.body; | ||
var mountNode = props.getPopupContainer ? props.getPopupContainer((0, _reactDom.findDOMNode)(instance)) : props.getDocument().body; | ||
mountNode.appendChild(popupContainer); | ||
@@ -110,2 +109,3 @@ return popupContainer; | ||
getPopupClassNameFromAlign: returnEmptyString, | ||
getDocument: returnDocument, | ||
onPopupVisibleChange: noop, | ||
@@ -176,4 +176,5 @@ afterPopupVisibleChange: noop, | ||
if (!this.clickOutsideHandler) { | ||
this.clickOutsideHandler = (0, _addEventListener2["default"])(document, 'mousedown', this.onDocumentClick); | ||
this.touchOutsideHandler = (0, _addEventListener2["default"])(document, 'touchstart', this.onDocumentClick); | ||
var currentDocument = props.getDocument(); | ||
this.clickOutsideHandler = (0, _addEventListener2["default"])(currentDocument, 'mousedown', this.onDocumentClick); | ||
this.touchOutsideHandler = (0, _addEventListener2["default"])(currentDocument, 'touchstart', this.onDocumentClick); | ||
} | ||
@@ -327,3 +328,3 @@ return; | ||
_Popup2["default"], | ||
(0, _extends3["default"])({ | ||
_extends({ | ||
prefixCls: props.prefixCls, | ||
@@ -330,0 +331,0 @@ destroyPopupOnHide: props.destroyPopupOnHide, |
@@ -7,11 +7,6 @@ 'use strict'; | ||
var _extends2 = require('babel-runtime/helpers/extends'); | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
var _extends3 = _interopRequireDefault(_extends2); | ||
exports.getAlignFromPlacement = getAlignFromPlacement; | ||
exports.getPopupClassNameFromAlign = getPopupClassNameFromAlign; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
function isPointsEq(a1, a2) { | ||
@@ -23,3 +18,3 @@ return a1[0] === a2[0] && a1[1] === a2[1]; | ||
var baseAlign = builtinPlacements[placementStr] || {}; | ||
return (0, _extends3["default"])({}, baseAlign, align); | ||
return _extends({}, baseAlign, align); | ||
} | ||
@@ -26,0 +21,0 @@ |
{ | ||
"name": "rc-trigger", | ||
"version": "1.8.3", | ||
"version": "1.8.4", | ||
"description": "base abstract trigger component for react", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -213,2 +213,8 @@ # rc-trigger | ||
<tr> | ||
<td>getDocument</td> | ||
<td>getDocument(): HTMLElement</td> | ||
<td></td> | ||
<td>function returning document node which will be attached click event to close trigger</td> | ||
</tr> | ||
<tr> | ||
<td>popupPlacement</td> | ||
@@ -215,0 +221,0 @@ <td>string</td> |
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
42038
252
933