rc-swipeout
Advanced tools
Comparing version 1.0.1 to 1.0.2
# History | ||
## 1.1.0 | ||
gestures based react-hammerjs | ||
## 1.0.2 | ||
- [`fix`] error if this.refs.left/right is [] | ||
## 1.0.1 | ||
- [`fix`] npm package empty | ||
## 1.0.0 | ||
init project |
@@ -44,2 +44,3 @@ 'use strict'; | ||
_this.openedRight = false; | ||
_this.disabledPan = false; | ||
return _this; | ||
@@ -61,3 +62,18 @@ } | ||
Swipeout.prototype.onPanStart = function onPanStart(e) { | ||
if (this.props.disabled) { | ||
// cannot set direction by react-harmmerjs, fix left & right direction temporarily | ||
// wait react-harmmerjs pr #46 to merge | ||
var _props2 = this.props; | ||
var left = _props2.left; | ||
var right = _props2.right; | ||
var aev = e.additionalEvent; | ||
if (aev === 'panright' && !left.length) { | ||
this.disabledPan = true; | ||
} else if (aev === 'panleft' && !right.length) { | ||
this.disabledPan = true; | ||
} else { | ||
this.disabledPan = false; | ||
} | ||
if (this.props.disabled || this.disabledPan) { | ||
return; | ||
@@ -69,3 +85,3 @@ } | ||
Swipeout.prototype.onPan = function onPan(e) { | ||
if (this.props.disabled) { | ||
if (this.props.disabled || this.disabledPan) { | ||
return; | ||
@@ -90,3 +106,3 @@ } | ||
Swipeout.prototype.onPanEnd = function onPanEnd(e) { | ||
if (this.props.disabled) { | ||
if (this.props.disabled || this.disabledPan) { | ||
return; | ||
@@ -152,10 +168,17 @@ } | ||
Swipeout.prototype._setStyle = function _setStyle(value) { | ||
var _props3 = this.props; | ||
var left = _props3.left; | ||
var right = _props3.right; | ||
var limit = value > 0 ? this.btnsLeftWidth : -this.btnsRightWidth; | ||
var leftWidth = Math.max(Math.min(value, Math.abs(limit)), 0); | ||
var rightWidth = Math.max(Math.min(-value, Math.abs(limit)), 0); | ||
var contentLeft = this._getContentEasing(value, limit); | ||
this.refs.content.style.left = contentLeft + 'px'; | ||
this.refs.left.style.width = leftWidth + 'px'; | ||
this.refs.right.style.width = rightWidth + 'px'; | ||
if (left.length) { | ||
var leftWidth = Math.max(Math.min(value, Math.abs(limit)), 0); | ||
this.refs.left.style.width = leftWidth + 'px'; | ||
} | ||
if (right.length) { | ||
var rightWidth = Math.max(Math.min(-value, Math.abs(limit)), 0); | ||
this.refs.right.style.width = rightWidth + 'px'; | ||
} | ||
}; | ||
@@ -213,9 +236,9 @@ | ||
Swipeout.prototype.render = function render() { | ||
var _props2 = this.props; | ||
var prefixCls = _props2.prefixCls; | ||
var left = _props2.left; | ||
var right = _props2.right; | ||
var children = _props2.children; | ||
var _props4 = this.props; | ||
var prefixCls = _props4.prefixCls; | ||
var left = _props4.left; | ||
var right = _props4.right; | ||
var children = _props4.children; | ||
var others = _objectWithoutProperties(_props2, ['prefixCls', 'left', 'right', 'children']); | ||
var others = _objectWithoutProperties(_props4, ['prefixCls', 'left', 'right', 'children']); | ||
@@ -242,3 +265,7 @@ return left.length || right.length ? _react2["default"].createElement( | ||
this.renderButtons(right, 'right') | ||
) : children; | ||
) : _react2["default"].createElement( | ||
'div', | ||
{ ref: 'content' }, | ||
children | ||
); | ||
}; | ||
@@ -245,0 +272,0 @@ |
{ | ||
"name": "rc-swipeout", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "swipe out ui component for react", | ||
@@ -9,12 +9,13 @@ "keywords": [ | ||
"swipeout", | ||
"rc-swipeout", | ||
"swipe delete" | ||
], | ||
"homepage": "https://github.com/react-component/rc-swipeout", | ||
"homepage": "https://github.com/react-component/swipeout", | ||
"author": "rjmuqiang@gmail.com", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/react-component/rc-swipeout.git" | ||
"url": "https://github.com/react-component/swipeout.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/react-component/rc-swipeout/issues" | ||
"url": "https://github.com/react-component/swipeout/issues" | ||
}, | ||
@@ -47,2 +48,3 @@ "files": [ | ||
"expect.js": "0.3.x", | ||
"hammer-simulator": "0.0.1", | ||
"pre-commit": "1.x", | ||
@@ -49,0 +51,0 @@ "rc-tools": "5.x", |
@@ -8,11 +8,14 @@ # rc-swipeout | ||
[![build status][travis-image]][travis-url] | ||
[![Test coverage][coveralls-image]][coveralls-url] | ||
[npm-image]: http://img.shields.io/npm/v/rc-swipeout.svg?style=flat-square | ||
[npm-url]: http://npmjs.org/package/rc-swipeout | ||
[travis-image]: https://img.shields.io/travis/react-component/rc-swipeout.svg?style=flat-square | ||
[travis-url]: https://travis-ci.org/react-component/rc-swipeout | ||
[travis-image]: https://img.shields.io/travis/react-component/swipeout.svg?style=flat-square | ||
[travis-url]: https://travis-ci.org/react-component/swipeout | ||
[coveralls-image]: https://img.shields.io/coveralls/react-component/swipeout.svg?style=flat-square | ||
[coveralls-url]: https://coveralls.io/r/react-component/swipeout?branch=master | ||
## Screenshots | ||
![swipeout](http://silentcloud.github.io/upload/swipeout.gif) | ||
![rc-swipeout](https://zos.alipayobjects.com/rmsportal/dqxQTtxrKrGMVEc.gif) | ||
@@ -33,3 +36,3 @@ ## Installation | ||
- local: http://localhost:8000/examples/ | ||
- online: http://react-component.github.io/rc-swipeout/ | ||
- online: http://react-component.github.io/swipeout/ | ||
@@ -68,3 +71,3 @@ ## Usage | ||
| 属性 | 说明 | 类型 | 默认值 | | ||
| name | description | type | default | | ||
|-------------|------------------------|--------|------------| | ||
@@ -82,3 +85,3 @@ | prefixCls | className prefix | String | `rc-swipeout` | | ||
| 属性 | 说明 | 类型 | 默认值 | | ||
| name | description | type | default | | ||
|-------------|------------------------|--------|------------| | ||
@@ -106,2 +109,2 @@ | text | button text | String | `Click` | | ||
react-swipeout is released under the MIT license. | ||
rc-swipeout is released under the MIT license. |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
14933
300
106
0
7