Skip to content

Commit 5ee7074

Browse files
committed
3.0.9
1 parent 547158b commit 5ee7074

File tree

4 files changed

+48
-13
lines changed

4 files changed

+48
-13
lines changed

Diff for: CHANGELOG.md

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
## Change Log
22

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

78
### 3.0.7 (2016/06/24 13:58 +00:00)
89
- [#124](https://github.com/wwayne/react-tooltip/pull/124) Consider both vertical and horizontal into place re-calculation (@wwayne)
@@ -74,4 +75,4 @@
7475
- [#15](https://github.com/wwayne/react-tooltip/pull/15) Adding support for server-side rendering (@bluejamesbond)
7576
- [#8](https://github.com/wwayne/react-tooltip/pull/8) Change curly brackets to quotes (single) (@af7)
7677
- [#6](https://github.com/wwayne/react-tooltip/pull/6) Fix bug with mouse hover triggerring on tooltip children (@tom-s)
77-
- [#5](https://github.com/wwayne/react-tooltip/pull/5) fixed classnames require call (@mciparelli)
78+
- [#5](https://github.com/wwayne/react-tooltip/pull/5) fixed classnames require call (@mciparelli)

Diff for: package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-tooltip",
3-
"version": "3.0.8",
3+
"version": "3.0.9",
44
"description": "react tooltip component",
55
"main": "dist/index.js",
66
"scripts": {

Diff for: standalone/react-tooltip.js

+40-6
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,7 @@ var ReactTooltip = (0, _staticMethods2.default)(_class = (0, _windowListener2.de
357357
_this.mount = true;
358358
_this.delayShowLoop = null;
359359
_this.delayHideLoop = null;
360+
_this.intervalUpdateContent = null;
360361
return _this;
361362
}
362363

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

375-
clearTimeout(this.delayShowLoop);
376-
clearTimeout(this.delayHideLoop);
376+
this.clearTimer();
377377

378378
this.unbindListener();
379379
this.removeScrollListener();
@@ -492,10 +492,21 @@ var ReactTooltip = (0, _staticMethods2.default)(_class = (0, _windowListener2.de
492492
var _props3 = this.props;
493493
var children = _props3.children;
494494
var multiline = _props3.multiline;
495+
var getContent = _props3.getContent;
495496

496497
var originTooltip = e.currentTarget.getAttribute('data-tip');
497498
var isMultiline = e.currentTarget.getAttribute('data-multiline') || multiline || false;
498-
var placeholder = (0, _getTipContent2.default)(originTooltip, children, isMultiline);
499+
500+
var content = children;
501+
if (getContent) {
502+
if (Array.isArray(getContent)) {
503+
content = getContent[0] && getContent[0]();
504+
} else {
505+
content = getContent();
506+
}
507+
}
508+
509+
var placeholder = (0, _getTipContent2.default)(originTooltip, content, isMultiline);
499510

500511
this.setState({
501512
placeholder: placeholder,
@@ -511,6 +522,17 @@ var ReactTooltip = (0, _staticMethods2.default)(_class = (0, _windowListener2.de
511522
}, function () {
512523
_this4.addScrollListener(e);
513524
_this4.updateTooltip(e);
525+
526+
if (getContent && Array.isArray(getContent)) {
527+
_this4.intervalUpdateContent = setInterval(function () {
528+
var getContent = _this4.props.getContent;
529+
530+
var placeholder = (0, _getTipContent2.default)(originTooltip, getContent[0](), isMultiline);
531+
_this4.setState({
532+
placeholder: placeholder
533+
});
534+
}, getContent[1]);
535+
}
514536
});
515537
}
516538

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

561583
if (!this.mount) return;
562584

563-
clearTimeout(this.delayShowLoop);
564-
clearTimeout(this.delayHideLoop);
585+
this.clearTimer();
565586
this.delayHideLoop = setTimeout(function () {
566587
_this6.setState({
567588
show: false
@@ -631,6 +652,18 @@ var ReactTooltip = (0, _staticMethods2.default)(_class = (0, _windowListener2.de
631652
document.getElementsByTagName('head')[0].appendChild(tag);
632653
}
633654
}
655+
656+
/**
657+
* CLear all kinds of timeout of interval
658+
*/
659+
660+
}, {
661+
key: 'clearTimer',
662+
value: function clearTimer() {
663+
clearTimeout(this.delayShowLoop);
664+
clearTimeout(this.delayHideLoop);
665+
clearInterval(this.intervalUpdateContent);
666+
}
634667
}, {
635668
key: 'render',
636669
value: function render() {
@@ -674,7 +707,8 @@ var ReactTooltip = (0, _staticMethods2.default)(_class = (0, _windowListener2.de
674707
eventOff: _react.PropTypes.string,
675708
watchWindow: _react.PropTypes.bool,
676709
isCapture: _react.PropTypes.bool,
677-
globalEventOff: _react.PropTypes.string
710+
globalEventOff: _react.PropTypes.string,
711+
getContent: _react.PropTypes.any
678712
}, _temp)) || _class) || _class) || _class) || _class;
679713

680714
/* export default not fit for standalone, it will exports {default:...} */

Diff for: standalone/react-tooltip.min.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)