Skip to content

Commit 6e48f15

Browse files
committed
3.2.5
1 parent 6da857e commit 6e48f15

File tree

5 files changed

+74
-73
lines changed

5 files changed

+74
-73
lines changed

example/src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ const Test = React.createClass({
4646
<section className='tooltip-example'>
4747
<h4 className='title'>React Tooltip</h4>
4848
<div className='demonstration'>
49-
<a data-for='main' data-tip="Hello<br />multiline<br />tooltip">
49+
<a data-for='main' data-tip="Hello<br />multiline<br />tooltip" data-iscapture="true">
5050
◕‿‿◕
5151
</a>
5252
</div>

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-tooltip",
3-
"version": "3.2.4",
3+
"version": "3.2.5",
44
"description": "react tooltip component",
55
"main": "dist/index.js",
66
"scripts": {
@@ -45,6 +45,9 @@
4545
"dependencies": {
4646
"classnames": "^2.2.0"
4747
},
48+
"engines": {
49+
"node": ">=4.2.1"
50+
},
4851
"devDependencies": {
4952
"babel-cli": "^6.5.1",
5053
"babel-core": "^6.9.1",

src/decorators/isCapture.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44

55
export default function (target) {
66
target.prototype.isCapture = function (currentTarget) {
7+
console.log('currentTarget', currentTarget)
78
const dataIsCapture = currentTarget.getAttribute('data-iscapture')
9+
console.log(currentTarget.getAttribute('data-iscapture'), dataIsCapture)
810
return dataIsCapture && dataIsCapture === 'true' || this.props.isCapture || false
911
}
1012
}

standalone/react-tooltip.js

Lines changed: 65 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,9 @@ exports.default = function (target) {
8181
target.prototype.customBindListener = function (ele) {
8282
var _this = this;
8383

84-
var _state = this.state;
85-
var event = _state.event;
86-
var eventOff = _state.eventOff;
84+
var _state = this.state,
85+
event = _state.event,
86+
eventOff = _state.eventOff;
8787

8888
var dataEvent = ele.getAttribute('data-event') || event;
8989
var dataEventOff = ele.getAttribute('data-event-off') || eventOff;
@@ -103,9 +103,9 @@ exports.default = function (target) {
103103

104104
/* Unbind listener for custom event */
105105
target.prototype.customUnbindListener = function (ele) {
106-
var _state2 = this.state;
107-
var event = _state2.event;
108-
var eventOff = _state2.eventOff;
106+
var _state2 = this.state,
107+
event = _state2.event,
108+
eventOff = _state2.eventOff;
109109

110110
var dataEvent = event || ele.getAttribute('data-event');
111111
var dataEventOff = eventOff || ele.getAttribute('data-event-off');
@@ -176,7 +176,9 @@ Object.defineProperty(exports, "__esModule", {
176176

177177
exports.default = function (target) {
178178
target.prototype.isCapture = function (currentTarget) {
179+
console.log('currentTarget', currentTarget);
179180
var dataIsCapture = currentTarget.getAttribute('data-iscapture');
181+
console.log(currentTarget.getAttribute('data-iscapture'), dataIsCapture);
180182
return dataIsCapture && dataIsCapture === 'true' || this.props.isCapture || false;
181183
};
182184
};
@@ -439,9 +441,9 @@ var ReactTooltip = (0, _staticMethods2.default)(_class = (0, _windowListener2.de
439441
}, {
440442
key: 'componentDidMount',
441443
value: function componentDidMount() {
442-
var _props = this.props;
443-
var insecure = _props.insecure;
444-
var resizeHide = _props.resizeHide;
444+
var _props = this.props,
445+
insecure = _props.insecure,
446+
resizeHide = _props.resizeHide;
445447

446448
if (insecure) {
447449
this.setStyleHeader(); // Set the style to the <link>
@@ -507,9 +509,9 @@ var ReactTooltip = (0, _staticMethods2.default)(_class = (0, _windowListener2.de
507509
value: function bindListener() {
508510
var _this3 = this;
509511

510-
var _props2 = this.props;
511-
var id = _props2.id;
512-
var globalEventOff = _props2.globalEventOff;
512+
var _props2 = this.props,
513+
id = _props2.id,
514+
globalEventOff = _props2.globalEventOff;
513515

514516
var targetArray = this.getTargetArray(id);
515517

@@ -549,9 +551,9 @@ var ReactTooltip = (0, _staticMethods2.default)(_class = (0, _windowListener2.de
549551
value: function unbindListener() {
550552
var _this4 = this;
551553

552-
var _props3 = this.props;
553-
var id = _props3.id;
554-
var globalEventOff = _props3.globalEventOff;
554+
var _props3 = this.props,
555+
id = _props3.id,
556+
globalEventOff = _props3.globalEventOff;
555557

556558
var targetArray = this.getTargetArray(id);
557559
targetArray.forEach(function (target) {
@@ -596,10 +598,10 @@ var ReactTooltip = (0, _staticMethods2.default)(_class = (0, _windowListener2.de
596598
}
597599
// Get the tooltip content
598600
// calculate in this phrase so that tip width height can be detected
599-
var _props4 = this.props;
600-
var children = _props4.children;
601-
var multiline = _props4.multiline;
602-
var getContent = _props4.getContent;
601+
var _props4 = this.props,
602+
children = _props4.children,
603+
multiline = _props4.multiline,
604+
getContent = _props4.getContent;
603605

604606
var originTooltip = e.currentTarget.getAttribute('data-tip');
605607
var isMultiline = e.currentTarget.getAttribute('data-multiline') || multiline || false;
@@ -673,11 +675,11 @@ var ReactTooltip = (0, _staticMethods2.default)(_class = (0, _windowListener2.de
673675
value: function updateTooltip(e) {
674676
var _this6 = this;
675677

676-
var _state = this.state;
677-
var delayShow = _state.delayShow;
678-
var show = _state.show;
679-
var isEmptyTip = _state.isEmptyTip;
680-
var disable = _state.disable;
678+
var _state = this.state,
679+
delayShow = _state.delayShow,
680+
show = _state.show,
681+
isEmptyTip = _state.isEmptyTip,
682+
disable = _state.disable;
681683
var afterShow = this.props.afterShow;
682684
var placeholder = this.state.placeholder;
683685

@@ -718,10 +720,10 @@ var ReactTooltip = (0, _staticMethods2.default)(_class = (0, _windowListener2.de
718720
value: function hideTooltip(e, hasTarget) {
719721
var _this7 = this;
720722

721-
var _state2 = this.state;
722-
var delayHide = _state2.delayHide;
723-
var isEmptyTip = _state2.isEmptyTip;
724-
var disable = _state2.disable;
723+
var _state2 = this.state,
724+
delayHide = _state2.delayHide,
725+
isEmptyTip = _state2.isEmptyTip,
726+
disable = _state2.disable;
725727
var afterHide = this.props.afterHide;
726728

727729
if (!this.mount) return;
@@ -776,12 +778,12 @@ var ReactTooltip = (0, _staticMethods2.default)(_class = (0, _windowListener2.de
776778
value: function updatePosition() {
777779
var _this8 = this;
778780

779-
var _state3 = this.state;
780-
var currentEvent = _state3.currentEvent;
781-
var currentTarget = _state3.currentTarget;
782-
var place = _state3.place;
783-
var effect = _state3.effect;
784-
var offset = _state3.offset;
781+
var _state3 = this.state,
782+
currentEvent = _state3.currentEvent,
783+
currentTarget = _state3.currentTarget,
784+
place = _state3.place,
785+
effect = _state3.effect,
786+
offset = _state3.offset;
785787

786788
var node = _reactDom2.default.findDOMNode(this);
787789
var result = (0, _getPosition2.default)(currentEvent, currentTarget, node, place, effect, offset);
@@ -827,13 +829,13 @@ var ReactTooltip = (0, _staticMethods2.default)(_class = (0, _windowListener2.de
827829
}, {
828830
key: 'render',
829831
value: function render() {
830-
var _state4 = this.state;
831-
var placeholder = _state4.placeholder;
832-
var extraClass = _state4.extraClass;
833-
var html = _state4.html;
834-
var ariaProps = _state4.ariaProps;
835-
var disable = _state4.disable;
836-
var isEmptyTip = _state4.isEmptyTip;
832+
var _state4 = this.state,
833+
placeholder = _state4.placeholder,
834+
extraClass = _state4.extraClass,
835+
html = _state4.html,
836+
ariaProps = _state4.ariaProps,
837+
disable = _state4.disable,
838+
isEmptyTip = _state4.isEmptyTip;
837839

838840
var tooltipClass = (0, _classnames2.default)('__react_component_tooltip', { 'show': this.state.show && !disable && !isEmptyTip }, { 'border': this.state.border }, { 'place-top': this.state.place === 'top' }, { 'place-bottom': this.state.place === 'bottom' }, { 'place-left': this.state.place === 'left' }, { 'place-right': this.state.place === 'right' }, { 'type-dark': this.state.type === 'dark' }, { 'type-success': this.state.type === 'success' }, { 'type-warning': this.state.type === 'warning' }, { 'type-error': this.state.type === 'error' }, { 'type-info': this.state.type === 'info' }, { 'type-light': this.state.type === 'light' });
839841

@@ -944,29 +946,26 @@ exports.default = function (e, target, node, place, effect, offset) {
944946
var tipWidth = node.clientWidth;
945947
var tipHeight = node.clientHeight;
946948

947-
var _getCurrentOffset = getCurrentOffset(e, target, effect);
948-
949-
var mouseX = _getCurrentOffset.mouseX;
950-
var mouseY = _getCurrentOffset.mouseY;
949+
var _getCurrentOffset = getCurrentOffset(e, target, effect),
950+
mouseX = _getCurrentOffset.mouseX,
951+
mouseY = _getCurrentOffset.mouseY;
951952

952953
var defaultOffset = getDefaultPosition(effect, target.clientWidth, target.clientHeight, tipWidth, tipHeight);
953954

954-
var _calculateOffset = calculateOffset(offset);
955-
956-
var extraOffset_X = _calculateOffset.extraOffset_X;
957-
var extraOffset_Y = _calculateOffset.extraOffset_Y;
958-
955+
var _calculateOffset = calculateOffset(offset),
956+
extraOffset_X = _calculateOffset.extraOffset_X,
957+
extraOffset_Y = _calculateOffset.extraOffset_Y;
959958

960959
var windowWidth = window.innerWidth;
961960
var windowHeight = window.innerHeight;
962961

963-
var _getParent = getParent(node);
964-
965-
var parentTop = _getParent.parentTop;
966-
var parentLeft = _getParent.parentLeft;
962+
var _getParent = getParent(node),
963+
parentTop = _getParent.parentTop,
964+
parentLeft = _getParent.parentLeft;
967965

968966
// Get the edge offset of the tooltip
969967

968+
970969
var getTipOffsetLeft = function getTipOffsetLeft(place) {
971970
var offset_X = defaultOffset[place].l;
972971
return mouseX + offset_X + extraOffset_X;
@@ -998,10 +997,10 @@ exports.default = function (e, target, node, place, effect, offset) {
998997
return { result: result, newPlace: newPlace };
999998
};
1000999
var outsideLeft = function outsideLeft() {
1001-
var _outsideVertical = outsideVertical();
1000+
var _outsideVertical = outsideVertical(),
1001+
result = _outsideVertical.result,
1002+
newPlace = _outsideVertical.newPlace; // Deal with vertical as first priority
10021003

1003-
var result = _outsideVertical.result;
1004-
var newPlace = _outsideVertical.newPlace; // Deal with vertical as first priority
10051004

10061005
if (result && outsideHorizontal().result) {
10071006
return { result: false }; // No need to change, if change to vertical will out of space
@@ -1013,10 +1012,9 @@ exports.default = function (e, target, node, place, effect, offset) {
10131012
return { result: result, newPlace: newPlace };
10141013
};
10151014
var outsideRight = function outsideRight() {
1016-
var _outsideVertical2 = outsideVertical();
1017-
1018-
var result = _outsideVertical2.result;
1019-
var newPlace = _outsideVertical2.newPlace;
1015+
var _outsideVertical2 = outsideVertical(),
1016+
result = _outsideVertical2.result,
1017+
newPlace = _outsideVertical2.newPlace;
10201018

10211019
if (result && outsideHorizontal().result) {
10221020
return { result: false }; // No need to change, if change to vertical will out of space
@@ -1041,10 +1039,9 @@ exports.default = function (e, target, node, place, effect, offset) {
10411039
return { result: result, newPlace: newPlace };
10421040
};
10431041
var outsideTop = function outsideTop() {
1044-
var _outsideHorizontal = outsideHorizontal();
1045-
1046-
var result = _outsideHorizontal.result;
1047-
var newPlace = _outsideHorizontal.newPlace;
1042+
var _outsideHorizontal = outsideHorizontal(),
1043+
result = _outsideHorizontal.result,
1044+
newPlace = _outsideHorizontal.newPlace;
10481045

10491046
if (result && outsideVertical().result) {
10501047
return { result: false };
@@ -1056,10 +1053,9 @@ exports.default = function (e, target, node, place, effect, offset) {
10561053
return { result: result, newPlace: newPlace };
10571054
};
10581055
var outsideBottom = function outsideBottom() {
1059-
var _outsideHorizontal2 = outsideHorizontal();
1060-
1061-
var result = _outsideHorizontal2.result;
1062-
var newPlace = _outsideHorizontal2.newPlace;
1056+
var _outsideHorizontal2 = outsideHorizontal(),
1057+
result = _outsideHorizontal2.result,
1058+
newPlace = _outsideHorizontal2.newPlace;
10631059

10641060
if (result && outsideVertical().result) {
10651061
return { result: false };

standalone/react-tooltip.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)