Skip to content

Commit

Permalink
3.0.9
Browse files Browse the repository at this point in the history
  • Loading branch information
wwayne committed Jul 12, 2016
1 parent 547158b commit 5ee7074
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 13 deletions.
9 changes: 5 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
## Change Log

### 3.0.8 (2016/07/01 09:29 +00:00)
- [#127](https://github.com/wwayne/react-tooltip/pull/127) Fix stack overflow in some edge case of position calculation (@wwayne)
- [#125](https://github.com/wwayne/react-tooltip/pull/125) Update page title for example page (@brandly)
### 3.0.9 (2016/07/12 00:23 +00:00)
- [#132](https://github.com/wwayne/react-tooltip/pull/132) Make getContent to support dynamical generate content while hover (@wwayne)
- [#131](https://github.com/wwayne/react-tooltip/pull/131) Add possibility to recalculate content on show tooltip (@pokidovea)
- [#128](https://github.com/wwayne/react-tooltip/pull/128) Correct Typos in README.md (@gottsohn)

### 3.0.7 (2016/06/24 13:58 +00:00)
- [#124](https://github.com/wwayne/react-tooltip/pull/124) Consider both vertical and horizontal into place re-calculation (@wwayne)
Expand Down Expand Up @@ -74,4 +75,4 @@
- [#15](https://github.com/wwayne/react-tooltip/pull/15) Adding support for server-side rendering (@bluejamesbond)
- [#8](https://github.com/wwayne/react-tooltip/pull/8) Change curly brackets to quotes (single) (@af7)
- [#6](https://github.com/wwayne/react-tooltip/pull/6) Fix bug with mouse hover triggerring on tooltip children (@tom-s)
- [#5](https://github.com/wwayne/react-tooltip/pull/5) fixed classnames require call (@mciparelli)
- [#5](https://github.com/wwayne/react-tooltip/pull/5) fixed classnames require call (@mciparelli)
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-tooltip",
"version": "3.0.8",
"version": "3.0.9",
"description": "react tooltip component",
"main": "dist/index.js",
"scripts": {
Expand Down
46 changes: 40 additions & 6 deletions standalone/react-tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,7 @@ var ReactTooltip = (0, _staticMethods2.default)(_class = (0, _windowListener2.de
_this.mount = true;
_this.delayShowLoop = null;
_this.delayHideLoop = null;
_this.intervalUpdateContent = null;
return _this;
}

Expand All @@ -372,8 +373,7 @@ var ReactTooltip = (0, _staticMethods2.default)(_class = (0, _windowListener2.de
value: function componentWillUnmount() {
this.mount = false;

clearTimeout(this.delayShowLoop);
clearTimeout(this.delayHideLoop);
this.clearTimer();

this.unbindListener();
this.removeScrollListener();
Expand Down Expand Up @@ -492,10 +492,21 @@ var ReactTooltip = (0, _staticMethods2.default)(_class = (0, _windowListener2.de
var _props3 = this.props;
var children = _props3.children;
var multiline = _props3.multiline;
var getContent = _props3.getContent;

var originTooltip = e.currentTarget.getAttribute('data-tip');
var isMultiline = e.currentTarget.getAttribute('data-multiline') || multiline || false;
var placeholder = (0, _getTipContent2.default)(originTooltip, children, isMultiline);

var content = children;
if (getContent) {
if (Array.isArray(getContent)) {
content = getContent[0] && getContent[0]();
} else {
content = getContent();
}
}

var placeholder = (0, _getTipContent2.default)(originTooltip, content, isMultiline);

this.setState({
placeholder: placeholder,
Expand All @@ -511,6 +522,17 @@ var ReactTooltip = (0, _staticMethods2.default)(_class = (0, _windowListener2.de
}, function () {
_this4.addScrollListener(e);
_this4.updateTooltip(e);

if (getContent && Array.isArray(getContent)) {
_this4.intervalUpdateContent = setInterval(function () {
var getContent = _this4.props.getContent;

var placeholder = (0, _getTipContent2.default)(originTooltip, getContent[0](), isMultiline);
_this4.setState({
placeholder: placeholder
});
}, getContent[1]);
}
});
}

Expand Down Expand Up @@ -560,8 +582,7 @@ var ReactTooltip = (0, _staticMethods2.default)(_class = (0, _windowListener2.de

if (!this.mount) return;

clearTimeout(this.delayShowLoop);
clearTimeout(this.delayHideLoop);
this.clearTimer();
this.delayHideLoop = setTimeout(function () {
_this6.setState({
show: false
Expand Down Expand Up @@ -631,6 +652,18 @@ var ReactTooltip = (0, _staticMethods2.default)(_class = (0, _windowListener2.de
document.getElementsByTagName('head')[0].appendChild(tag);
}
}

/**
* CLear all kinds of timeout of interval
*/

}, {
key: 'clearTimer',
value: function clearTimer() {
clearTimeout(this.delayShowLoop);
clearTimeout(this.delayHideLoop);
clearInterval(this.intervalUpdateContent);
}
}, {
key: 'render',
value: function render() {
Expand Down Expand Up @@ -674,7 +707,8 @@ var ReactTooltip = (0, _staticMethods2.default)(_class = (0, _windowListener2.de
eventOff: _react.PropTypes.string,
watchWindow: _react.PropTypes.bool,
isCapture: _react.PropTypes.bool,
globalEventOff: _react.PropTypes.string
globalEventOff: _react.PropTypes.string,
getContent: _react.PropTypes.any
}, _temp)) || _class) || _class) || _class) || _class;

/* export default not fit for standalone, it will exports {default:...} */
Expand Down
4 changes: 2 additions & 2 deletions standalone/react-tooltip.min.js

Large diffs are not rendered by default.

0 comments on commit 5ee7074

Please sign in to comment.