Skip to content

Commit 8a20794

Browse files
committed
3.2.7
1 parent 7ccd834 commit 8a20794

File tree

4 files changed

+95
-80
lines changed

4 files changed

+95
-80
lines changed

CHANGELOG.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
## Change Log
22

3-
### 3.2.6 (2017/02/08 12:33 +00:00)
3+
### 3.2.7 (2017/02/17 07:24 +00:00)
4+
- [#262](https://github.com/wwayne/react-tooltip/pull/262) Fix nodelist converte in safari (@wwayne)
5+
- [#260](https://github.com/wwayne/react-tooltip/pull/260) Fix NodeList to Array convertion (@huumanoid)
6+
7+
### 3.2.6 (2017/02/08 12:34 +00:00)
48
- [#255](https://github.com/wwayne/react-tooltip/pull/255) (fix) Remove console logs (@flexpert)
59
- [#254](https://github.com/wwayne/react-tooltip/pull/254) Add support for className prop (@jonbeller)
610

package.json

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

standalone/react-tooltip.js

+86-76
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');
@@ -372,6 +372,10 @@ var _getTipContent2 = _interopRequireDefault(_getTipContent);
372372

373373
var _aria = require('./utils/aria');
374374

375+
var _nodeListToArray = require('./utils/nodeListToArray');
376+
377+
var _nodeListToArray2 = _interopRequireDefault(_nodeListToArray);
378+
375379
var _style = require('./style');
376380

377381
var _style2 = _interopRequireDefault(_style);
@@ -439,9 +443,9 @@ var ReactTooltip = (0, _staticMethods2.default)(_class = (0, _windowListener2.de
439443
}, {
440444
key: 'componentDidMount',
441445
value: function componentDidMount() {
442-
var _props = this.props;
443-
var insecure = _props.insecure;
444-
var resizeHide = _props.resizeHide;
446+
var _props = this.props,
447+
insecure = _props.insecure,
448+
resizeHide = _props.resizeHide;
445449

446450
if (insecure) {
447451
this.setStyleHeader(); // Set the style to the <link>
@@ -483,18 +487,13 @@ var ReactTooltip = (0, _staticMethods2.default)(_class = (0, _windowListener2.de
483487
key: 'getTargetArray',
484488
value: function getTargetArray(id) {
485489
var targetArray = void 0;
486-
487490
if (!id) {
488491
targetArray = document.querySelectorAll('[data-tip]:not([data-for])');
489492
} else {
490493
targetArray = document.querySelectorAll('[data-tip][data-for="' + id + '"]');
491494
}
492-
493495
// targetArray is a NodeList, convert it to a real array
494-
// I hope I can use Object.values...
495-
return Object.getOwnPropertyNames(targetArray).map(function (key) {
496-
return targetArray[key];
497-
});
496+
return (0, _nodeListToArray2.default)(targetArray);
498497
}
499498

500499
/**
@@ -507,9 +506,9 @@ var ReactTooltip = (0, _staticMethods2.default)(_class = (0, _windowListener2.de
507506
value: function bindListener() {
508507
var _this3 = this;
509508

510-
var _props2 = this.props;
511-
var id = _props2.id;
512-
var globalEventOff = _props2.globalEventOff;
509+
var _props2 = this.props,
510+
id = _props2.id,
511+
globalEventOff = _props2.globalEventOff;
513512

514513
var targetArray = this.getTargetArray(id);
515514

@@ -549,9 +548,9 @@ var ReactTooltip = (0, _staticMethods2.default)(_class = (0, _windowListener2.de
549548
value: function unbindListener() {
550549
var _this4 = this;
551550

552-
var _props3 = this.props;
553-
var id = _props3.id;
554-
var globalEventOff = _props3.globalEventOff;
551+
var _props3 = this.props,
552+
id = _props3.id,
553+
globalEventOff = _props3.globalEventOff;
555554

556555
var targetArray = this.getTargetArray(id);
557556
targetArray.forEach(function (target) {
@@ -596,10 +595,10 @@ var ReactTooltip = (0, _staticMethods2.default)(_class = (0, _windowListener2.de
596595
}
597596
// Get the tooltip content
598597
// 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;
598+
var _props4 = this.props,
599+
children = _props4.children,
600+
multiline = _props4.multiline,
601+
getContent = _props4.getContent;
603602

604603
var originTooltip = e.currentTarget.getAttribute('data-tip');
605604
var isMultiline = e.currentTarget.getAttribute('data-multiline') || multiline || false;
@@ -673,11 +672,11 @@ var ReactTooltip = (0, _staticMethods2.default)(_class = (0, _windowListener2.de
673672
value: function updateTooltip(e) {
674673
var _this6 = this;
675674

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;
675+
var _state = this.state,
676+
delayShow = _state.delayShow,
677+
show = _state.show,
678+
isEmptyTip = _state.isEmptyTip,
679+
disable = _state.disable;
681680
var afterShow = this.props.afterShow;
682681
var placeholder = this.state.placeholder;
683682

@@ -718,10 +717,10 @@ var ReactTooltip = (0, _staticMethods2.default)(_class = (0, _windowListener2.de
718717
value: function hideTooltip(e, hasTarget) {
719718
var _this7 = this;
720719

721-
var _state2 = this.state;
722-
var delayHide = _state2.delayHide;
723-
var isEmptyTip = _state2.isEmptyTip;
724-
var disable = _state2.disable;
720+
var _state2 = this.state,
721+
delayHide = _state2.delayHide,
722+
isEmptyTip = _state2.isEmptyTip,
723+
disable = _state2.disable;
725724
var afterHide = this.props.afterHide;
726725

727726
if (!this.mount) return;
@@ -776,12 +775,12 @@ var ReactTooltip = (0, _staticMethods2.default)(_class = (0, _windowListener2.de
776775
value: function updatePosition() {
777776
var _this8 = this;
778777

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;
778+
var _state3 = this.state,
779+
currentEvent = _state3.currentEvent,
780+
currentTarget = _state3.currentTarget,
781+
place = _state3.place,
782+
effect = _state3.effect,
783+
offset = _state3.offset;
785784

786785
var node = _reactDom2.default.findDOMNode(this);
787786
var result = (0, _getPosition2.default)(currentEvent, currentTarget, node, place, effect, offset);
@@ -827,13 +826,13 @@ var ReactTooltip = (0, _staticMethods2.default)(_class = (0, _windowListener2.de
827826
}, {
828827
key: 'render',
829828
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;
829+
var _state4 = this.state,
830+
placeholder = _state4.placeholder,
831+
extraClass = _state4.extraClass,
832+
html = _state4.html,
833+
ariaProps = _state4.ariaProps,
834+
disable = _state4.disable,
835+
isEmptyTip = _state4.isEmptyTip;
837836

838837
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' });
839838

@@ -900,7 +899,7 @@ var ReactTooltip = (0, _staticMethods2.default)(_class = (0, _windowListener2.de
900899
module.exports = ReactTooltip;
901900

902901
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
903-
},{"./decorators/customEvent":3,"./decorators/getEffect":4,"./decorators/isCapture":5,"./decorators/staticMethods":6,"./decorators/windowListener":7,"./style":9,"./utils/aria":10,"./utils/getPosition":11,"./utils/getTipContent":12,"classnames":1}],9:[function(require,module,exports){
902+
},{"./decorators/customEvent":3,"./decorators/getEffect":4,"./decorators/isCapture":5,"./decorators/staticMethods":6,"./decorators/windowListener":7,"./style":9,"./utils/aria":10,"./utils/getPosition":11,"./utils/getTipContent":12,"./utils/nodeListToArray":13,"classnames":1}],9:[function(require,module,exports){
904903
'use strict';
905904

906905
Object.defineProperty(exports, "__esModule", {
@@ -945,29 +944,26 @@ exports.default = function (e, target, node, place, effect, offset) {
945944
var tipWidth = node.clientWidth;
946945
var tipHeight = node.clientHeight;
947946

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

953951
var defaultOffset = getDefaultPosition(effect, target.clientWidth, target.clientHeight, tipWidth, tipHeight);
954952

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

961957
var windowWidth = window.innerWidth;
962958
var windowHeight = window.innerHeight;
963959

964-
var _getParent = getParent(node);
965-
966-
var parentTop = _getParent.parentTop;
967-
var parentLeft = _getParent.parentLeft;
960+
var _getParent = getParent(node),
961+
parentTop = _getParent.parentTop,
962+
parentLeft = _getParent.parentLeft;
968963

969964
// Get the edge offset of the tooltip
970965

966+
971967
var getTipOffsetLeft = function getTipOffsetLeft(place) {
972968
var offset_X = defaultOffset[place].l;
973969
return mouseX + offset_X + extraOffset_X;
@@ -999,10 +995,10 @@ exports.default = function (e, target, node, place, effect, offset) {
999995
return { result: result, newPlace: newPlace };
1000996
};
1001997
var outsideLeft = function outsideLeft() {
1002-
var _outsideVertical = outsideVertical();
998+
var _outsideVertical = outsideVertical(),
999+
result = _outsideVertical.result,
1000+
newPlace = _outsideVertical.newPlace; // Deal with vertical as first priority
10031001

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

10071003
if (result && outsideHorizontal().result) {
10081004
return { result: false }; // No need to change, if change to vertical will out of space
@@ -1014,10 +1010,9 @@ exports.default = function (e, target, node, place, effect, offset) {
10141010
return { result: result, newPlace: newPlace };
10151011
};
10161012
var outsideRight = function outsideRight() {
1017-
var _outsideVertical2 = outsideVertical();
1018-
1019-
var result = _outsideVertical2.result;
1020-
var newPlace = _outsideVertical2.newPlace;
1013+
var _outsideVertical2 = outsideVertical(),
1014+
result = _outsideVertical2.result,
1015+
newPlace = _outsideVertical2.newPlace;
10211016

10221017
if (result && outsideHorizontal().result) {
10231018
return { result: false }; // No need to change, if change to vertical will out of space
@@ -1042,10 +1037,9 @@ exports.default = function (e, target, node, place, effect, offset) {
10421037
return { result: result, newPlace: newPlace };
10431038
};
10441039
var outsideTop = function outsideTop() {
1045-
var _outsideHorizontal = outsideHorizontal();
1046-
1047-
var result = _outsideHorizontal.result;
1048-
var newPlace = _outsideHorizontal.newPlace;
1040+
var _outsideHorizontal = outsideHorizontal(),
1041+
result = _outsideHorizontal.result,
1042+
newPlace = _outsideHorizontal.newPlace;
10491043

10501044
if (result && outsideVertical().result) {
10511045
return { result: false };
@@ -1057,10 +1051,9 @@ exports.default = function (e, target, node, place, effect, offset) {
10571051
return { result: result, newPlace: newPlace };
10581052
};
10591053
var outsideBottom = function outsideBottom() {
1060-
var _outsideHorizontal2 = outsideHorizontal();
1061-
1062-
var result = _outsideHorizontal2.result;
1063-
var newPlace = _outsideHorizontal2.newPlace;
1054+
var _outsideHorizontal2 = outsideHorizontal(),
1055+
result = _outsideHorizontal2.result,
1056+
newPlace = _outsideHorizontal2.newPlace;
10641057

10651058
if (result && outsideVertical().result) {
10661059
return { result: false };
@@ -1285,5 +1278,22 @@ var _react2 = _interopRequireDefault(_react);
12851278
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12861279

12871280
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
1281+
},{}],13:[function(require,module,exports){
1282+
"use strict";
1283+
1284+
Object.defineProperty(exports, "__esModule", {
1285+
value: true
1286+
});
1287+
1288+
exports.default = function (nodeList) {
1289+
var length = nodeList.length;
1290+
if (nodeList.hasOwnProperty) {
1291+
return Array.prototype.slice.call(nodeList);
1292+
}
1293+
return new Array(length).fill().map(function (index) {
1294+
return nodeList[index];
1295+
});
1296+
};
1297+
12881298
},{}]},{},[8])(8)
12891299
});

standalone/react-tooltip.min.js

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

0 commit comments

Comments
 (0)