Skip to content

Commit

Permalink
3.2.6
Browse files Browse the repository at this point in the history
  • Loading branch information
wwayne committed Feb 8, 2017
1 parent 375989f commit c4a4f87
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 71 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
## Change Log

### 3.2.4 (2017/02/07 03:53 +00:00)
### 3.2.6 (2017/02/08 12:33 +00:00)
- [#255](https://github.com/wwayne/react-tooltip/pull/255) (fix) Remove console logs (@flexpert)
- [#254](https://github.com/wwayne/react-tooltip/pull/254) Add support for className prop (@jonbeller)

### 3.2.4 (2017/02/07 03:57 +00:00)
- [#251](https://github.com/wwayne/react-tooltip/pull/251) Dropfen dynamic wrapper (@dropfen)

### 3.2.3 (2017/01/30 03:00 +00:00)
Expand Down
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.2.5",
"version": "3.2.6",
"description": "react tooltip component",
"main": "dist/index.js",
"scripts": {
Expand Down
137 changes: 71 additions & 66 deletions standalone/react-tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ exports.default = function (target) {
target.prototype.customBindListener = function (ele) {
var _this = this;

var _state = this.state,
event = _state.event,
eventOff = _state.eventOff;
var _state = this.state;
var event = _state.event;
var eventOff = _state.eventOff;

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

/* Unbind listener for custom event */
target.prototype.customUnbindListener = function (ele) {
var _state2 = this.state,
event = _state2.event,
eventOff = _state2.eventOff;
var _state2 = this.state;
var event = _state2.event;
var eventOff = _state2.eventOff;

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

exports.default = function (target) {
target.prototype.isCapture = function (currentTarget) {
console.log('currentTarget', currentTarget);
var dataIsCapture = currentTarget.getAttribute('data-iscapture');
console.log(currentTarget.getAttribute('data-iscapture'), dataIsCapture);
return dataIsCapture && dataIsCapture === 'true' || this.props.isCapture || false;
};
};
Expand Down Expand Up @@ -441,9 +439,9 @@ var ReactTooltip = (0, _staticMethods2.default)(_class = (0, _windowListener2.de
}, {
key: 'componentDidMount',
value: function componentDidMount() {
var _props = this.props,
insecure = _props.insecure,
resizeHide = _props.resizeHide;
var _props = this.props;
var insecure = _props.insecure;
var resizeHide = _props.resizeHide;

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

var _props2 = this.props,
id = _props2.id,
globalEventOff = _props2.globalEventOff;
var _props2 = this.props;
var id = _props2.id;
var globalEventOff = _props2.globalEventOff;

var targetArray = this.getTargetArray(id);

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

var _props3 = this.props,
id = _props3.id,
globalEventOff = _props3.globalEventOff;
var _props3 = this.props;
var id = _props3.id;
var globalEventOff = _props3.globalEventOff;

var targetArray = this.getTargetArray(id);
targetArray.forEach(function (target) {
Expand Down Expand Up @@ -598,10 +596,10 @@ var ReactTooltip = (0, _staticMethods2.default)(_class = (0, _windowListener2.de
}
// Get the tooltip content
// calculate in this phrase so that tip width height can be detected
var _props4 = this.props,
children = _props4.children,
multiline = _props4.multiline,
getContent = _props4.getContent;
var _props4 = this.props;
var children = _props4.children;
var multiline = _props4.multiline;
var getContent = _props4.getContent;

var originTooltip = e.currentTarget.getAttribute('data-tip');
var isMultiline = e.currentTarget.getAttribute('data-multiline') || multiline || false;
Expand Down Expand Up @@ -643,7 +641,7 @@ var ReactTooltip = (0, _staticMethods2.default)(_class = (0, _windowListener2.de
delayShow: e.currentTarget.getAttribute('data-delay-show') || this.props.delayShow || 0,
delayHide: e.currentTarget.getAttribute('data-delay-hide') || this.props.delayHide || 0,
border: e.currentTarget.getAttribute('data-border') ? e.currentTarget.getAttribute('data-border') === 'true' : this.props.border || false,
extraClass: e.currentTarget.getAttribute('data-class') || this.props.class || '',
extraClass: e.currentTarget.getAttribute('data-class') || this.props.class || this.props.className || '',
disable: e.currentTarget.getAttribute('data-tip-disable') ? e.currentTarget.getAttribute('data-tip-disable') === 'true' : this.props.disable || false
}, function () {
if (scrollHide) _this5.addScrollListener(e);
Expand Down Expand Up @@ -675,11 +673,11 @@ var ReactTooltip = (0, _staticMethods2.default)(_class = (0, _windowListener2.de
value: function updateTooltip(e) {
var _this6 = this;

var _state = this.state,
delayShow = _state.delayShow,
show = _state.show,
isEmptyTip = _state.isEmptyTip,
disable = _state.disable;
var _state = this.state;
var delayShow = _state.delayShow;
var show = _state.show;
var isEmptyTip = _state.isEmptyTip;
var disable = _state.disable;
var afterShow = this.props.afterShow;
var placeholder = this.state.placeholder;

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

var _state2 = this.state,
delayHide = _state2.delayHide,
isEmptyTip = _state2.isEmptyTip,
disable = _state2.disable;
var _state2 = this.state;
var delayHide = _state2.delayHide;
var isEmptyTip = _state2.isEmptyTip;
var disable = _state2.disable;
var afterHide = this.props.afterHide;

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

var _state3 = this.state,
currentEvent = _state3.currentEvent,
currentTarget = _state3.currentTarget,
place = _state3.place,
effect = _state3.effect,
offset = _state3.offset;
var _state3 = this.state;
var currentEvent = _state3.currentEvent;
var currentTarget = _state3.currentTarget;
var place = _state3.place;
var effect = _state3.effect;
var offset = _state3.offset;

var node = _reactDom2.default.findDOMNode(this);
var result = (0, _getPosition2.default)(currentEvent, currentTarget, node, place, effect, offset);
Expand Down Expand Up @@ -829,13 +827,13 @@ var ReactTooltip = (0, _staticMethods2.default)(_class = (0, _windowListener2.de
}, {
key: 'render',
value: function render() {
var _state4 = this.state,
placeholder = _state4.placeholder,
extraClass = _state4.extraClass,
html = _state4.html,
ariaProps = _state4.ariaProps,
disable = _state4.disable,
isEmptyTip = _state4.isEmptyTip;
var _state4 = this.state;
var placeholder = _state4.placeholder;
var extraClass = _state4.extraClass;
var html = _state4.html;
var ariaProps = _state4.ariaProps;
var disable = _state4.disable;
var isEmptyTip = _state4.isEmptyTip;

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

Expand Down Expand Up @@ -870,6 +868,7 @@ var ReactTooltip = (0, _staticMethods2.default)(_class = (0, _windowListener2.de
border: _react.PropTypes.bool,
insecure: _react.PropTypes.bool,
class: _react.PropTypes.string,
className: _react.PropTypes.string,
id: _react.PropTypes.string,
html: _react.PropTypes.bool,
delayHide: _react.PropTypes.number,
Expand Down Expand Up @@ -946,25 +945,28 @@ exports.default = function (e, target, node, place, effect, offset) {
var tipWidth = node.clientWidth;
var tipHeight = node.clientHeight;

var _getCurrentOffset = getCurrentOffset(e, target, effect),
mouseX = _getCurrentOffset.mouseX,
mouseY = _getCurrentOffset.mouseY;
var _getCurrentOffset = getCurrentOffset(e, target, effect);

var mouseX = _getCurrentOffset.mouseX;
var mouseY = _getCurrentOffset.mouseY;

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

var _calculateOffset = calculateOffset(offset),
extraOffset_X = _calculateOffset.extraOffset_X,
extraOffset_Y = _calculateOffset.extraOffset_Y;
var _calculateOffset = calculateOffset(offset);

var extraOffset_X = _calculateOffset.extraOffset_X;
var extraOffset_Y = _calculateOffset.extraOffset_Y;


var windowWidth = window.innerWidth;
var windowHeight = window.innerHeight;

var _getParent = getParent(node),
parentTop = _getParent.parentTop,
parentLeft = _getParent.parentLeft;
var _getParent = getParent(node);

// Get the edge offset of the tooltip
var parentTop = _getParent.parentTop;
var parentLeft = _getParent.parentLeft;

// Get the edge offset of the tooltip

var getTipOffsetLeft = function getTipOffsetLeft(place) {
var offset_X = defaultOffset[place].l;
Expand Down Expand Up @@ -997,10 +999,10 @@ exports.default = function (e, target, node, place, effect, offset) {
return { result: result, newPlace: newPlace };
};
var outsideLeft = function outsideLeft() {
var _outsideVertical = outsideVertical(),
result = _outsideVertical.result,
newPlace = _outsideVertical.newPlace; // Deal with vertical as first priority
var _outsideVertical = outsideVertical();

var result = _outsideVertical.result;
var newPlace = _outsideVertical.newPlace; // Deal with vertical as first priority

if (result && outsideHorizontal().result) {
return { result: false }; // No need to change, if change to vertical will out of space
Expand All @@ -1012,9 +1014,10 @@ exports.default = function (e, target, node, place, effect, offset) {
return { result: result, newPlace: newPlace };
};
var outsideRight = function outsideRight() {
var _outsideVertical2 = outsideVertical(),
result = _outsideVertical2.result,
newPlace = _outsideVertical2.newPlace;
var _outsideVertical2 = outsideVertical();

var result = _outsideVertical2.result;
var newPlace = _outsideVertical2.newPlace;

if (result && outsideHorizontal().result) {
return { result: false }; // No need to change, if change to vertical will out of space
Expand All @@ -1039,9 +1042,10 @@ exports.default = function (e, target, node, place, effect, offset) {
return { result: result, newPlace: newPlace };
};
var outsideTop = function outsideTop() {
var _outsideHorizontal = outsideHorizontal(),
result = _outsideHorizontal.result,
newPlace = _outsideHorizontal.newPlace;
var _outsideHorizontal = outsideHorizontal();

var result = _outsideHorizontal.result;
var newPlace = _outsideHorizontal.newPlace;

if (result && outsideVertical().result) {
return { result: false };
Expand All @@ -1053,9 +1057,10 @@ exports.default = function (e, target, node, place, effect, offset) {
return { result: result, newPlace: newPlace };
};
var outsideBottom = function outsideBottom() {
var _outsideHorizontal2 = outsideHorizontal(),
result = _outsideHorizontal2.result,
newPlace = _outsideHorizontal2.newPlace;
var _outsideHorizontal2 = outsideHorizontal();

var result = _outsideHorizontal2.result;
var newPlace = _outsideHorizontal2.newPlace;

if (result && outsideVertical().result) {
return { result: false };
Expand Down
5 changes: 2 additions & 3 deletions standalone/react-tooltip.min.js

Large diffs are not rendered by default.

0 comments on commit c4a4f87

Please sign in to comment.