From 3732095fce6d5b07f8f033684bb4bbf159e28359 Mon Sep 17 00:00:00 2001 From: wwayne Date: Tue, 21 Jun 2016 08:32:12 +0800 Subject: [PATCH] Fix custom event with specific id --- src/decorators/customEvent.js | 3 ++- standalone/react-tooltip.js | 3 ++- standalone/react-tooltip.min.js | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/decorators/customEvent.js b/src/decorators/customEvent.js index fd4627004..dcc0c7f3c 100644 --- a/src/decorators/customEvent.js +++ b/src/decorators/customEvent.js @@ -8,6 +8,7 @@ const checkStatus = function (dataEventOff, e) { const {show} = this.state + const {id} = this.props const dataIsCapture = e.currentTarget.getAttribute('data-iscapture') const isCapture = dataIsCapture && dataIsCapture === 'true' || this.props.isCapture const currentItem = e.currentTarget.getAttribute('currentItem') @@ -17,7 +18,7 @@ const checkStatus = function (dataEventOff, e) { if (!dataEventOff) this.hideTooltip(e) } else { e.currentTarget.setAttribute('currentItem', 'true') - setUntargetItems(e.currentTarget, this.getTargetArray()) + setUntargetItems(e.currentTarget, this.getTargetArray(id)) this.showTooltip(e) } } diff --git a/standalone/react-tooltip.js b/standalone/react-tooltip.js index e628b3613..050d48d07 100644 --- a/standalone/react-tooltip.js +++ b/standalone/react-tooltip.js @@ -124,6 +124,7 @@ exports.default = function (target) { var checkStatus = function checkStatus(dataEventOff, e) { var show = this.state.show; + var id = this.props.id; var dataIsCapture = e.currentTarget.getAttribute('data-iscapture'); var isCapture = dataIsCapture && dataIsCapture === 'true' || this.props.isCapture; @@ -134,7 +135,7 @@ var checkStatus = function checkStatus(dataEventOff, e) { if (!dataEventOff) this.hideTooltip(e); } else { e.currentTarget.setAttribute('currentItem', 'true'); - setUntargetItems(e.currentTarget, this.getTargetArray()); + setUntargetItems(e.currentTarget, this.getTargetArray(id)); this.showTooltip(e); } }; diff --git a/standalone/react-tooltip.min.js b/standalone/react-tooltip.min.js index a8428a2ae..eaaf4826e 100644 --- a/standalone/react-tooltip.min.js +++ b/standalone/react-tooltip.min.js @@ -1 +1 @@ -(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.ReactTooltip=f()}})(function(){var define,module,exports;return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o0||placeholder){_this5.setState({currentEvent:e,currentTarget:eventTarget,show:true},function(){_this5.updatePosition()})}},delayTime)}},{key:"hideTooltip",value:function hideTooltip(){var _this6=this;var delayHide=this.state.delayHide;if(!this.mount)return;clearTimeout(this.delayShowLoop);clearTimeout(this.delayHideLoop);this.delayHideLoop=setTimeout(function(){_this6.setState({show:false});_this6.removeScrollListener()},parseInt(delayHide,10))}},{key:"addScrollListener",value:function addScrollListener(e){var isCaptureMode=this.isCapture(e.currentTarget);window.addEventListener("scroll",this.hideTooltip.bind(this),isCaptureMode)}},{key:"removeScrollListener",value:function removeScrollListener(){window.removeEventListener("scroll",this.hideTooltip)}},{key:"updatePosition",value:function updatePosition(){var _this7=this;var _state2=this.state;var currentEvent=_state2.currentEvent;var currentTarget=_state2.currentTarget;var place=_state2.place;var effect=_state2.effect;var offset=_state2.offset;var node=_reactDom2.default.findDOMNode(this);var result=(0,_getPosition2.default)(currentEvent,currentTarget,node,place,effect,offset);if(result.isNewState){return this.setState(result.newState,function(){_this7.updatePosition()})}node.style.left=result.position.left+"px";node.style.top=result.position.top+"px"}},{key:"setStyleHeader",value:function setStyleHeader(){if(!document.getElementsByTagName("head")[0].querySelector('style[id="react-tooltip"]')){var tag=document.createElement("style");tag.id="react-tooltip";tag.innerHTML=_style2.default;document.getElementsByTagName("head")[0].appendChild(tag)}}},{key:"render",value:function render(){var _state3=this.state;var placeholder=_state3.placeholder;var extraClass=_state3.extraClass;var html=_state3.html;var tooltipClass=(0,_classnames2.default)("__react_component_tooltip",{show:this.state.show},{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"});if(html){return _react2.default.createElement("div",{className:tooltipClass+" "+extraClass,"data-id":"tooltip",dangerouslySetInnerHTML:{__html:placeholder}})}else{return _react2.default.createElement("div",{className:tooltipClass+" "+extraClass,"data-id":"tooltip"},placeholder)}}}]);return ReactTooltip}(_react.Component),_class2.propTypes={children:_react.PropTypes.any,place:_react.PropTypes.string,type:_react.PropTypes.string,effect:_react.PropTypes.string,offset:_react.PropTypes.object,multiline:_react.PropTypes.bool,border:_react.PropTypes.bool,"class":_react.PropTypes.string,id:_react.PropTypes.string,html:_react.PropTypes.bool,delayHide:_react.PropTypes.number,delayShow:_react.PropTypes.number,event:_react.PropTypes.string,eventOff:_react.PropTypes.string,watchWindow:_react.PropTypes.bool,isCapture:_react.PropTypes.bool,globalEventOff:_react.PropTypes.string},_temp))||_class)||_class)||_class)||_class;module.exports=ReactTooltip}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"./decorators/customEvent":3,"./decorators/isCapture":4,"./decorators/staticMethods":5,"./decorators/windowListener":6,"./style":8,"./utils/getPosition":9,"./utils/getTipContent":10,classnames:1}],8:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.default='.__react_component_tooltip{border-radius:3px;display:inline-block;font-size:13px;left:-999em;opacity:0;padding:8px 21px;position:fixed;pointer-events:none;transition:opacity 0.3s ease-out , margin-top 0.3s ease-out, margin-left 0.3s ease-out;top:-999em;visibility:hidden;z-index:999}.__react_component_tooltip:before,.__react_component_tooltip:after{content:"";width:0;height:0;position:absolute}.__react_component_tooltip.show{opacity:0.9;margin-top:0px;margin-left:0px;visibility:visible}.__react_component_tooltip.type-dark{color:#fff;background-color:#222}.__react_component_tooltip.type-dark.place-top:after{border-top-color:#222;border-top-style:solid;border-top-width:6px}.__react_component_tooltip.type-dark.place-bottom:after{border-bottom-color:#222;border-bottom-style:solid;border-bottom-width:6px}.__react_component_tooltip.type-dark.place-left:after{border-left-color:#222;border-left-style:solid;border-left-width:6px}.__react_component_tooltip.type-dark.place-right:after{border-right-color:#222;border-right-style:solid;border-right-width:6px}.__react_component_tooltip.type-dark.border{border:1px solid #fff}.__react_component_tooltip.type-dark.border.place-top:before{border-top:8px solid #fff}.__react_component_tooltip.type-dark.border.place-bottom:before{border-bottom:8px solid #fff}.__react_component_tooltip.type-dark.border.place-left:before{border-left:8px solid #fff}.__react_component_tooltip.type-dark.border.place-right:before{border-right:8px solid #fff}.__react_component_tooltip.type-success{color:#fff;background-color:#8DC572}.__react_component_tooltip.type-success.place-top:after{border-top-color:#8DC572;border-top-style:solid;border-top-width:6px}.__react_component_tooltip.type-success.place-bottom:after{border-bottom-color:#8DC572;border-bottom-style:solid;border-bottom-width:6px}.__react_component_tooltip.type-success.place-left:after{border-left-color:#8DC572;border-left-style:solid;border-left-width:6px}.__react_component_tooltip.type-success.place-right:after{border-right-color:#8DC572;border-right-style:solid;border-right-width:6px}.__react_component_tooltip.type-success.border{border:1px solid #fff}.__react_component_tooltip.type-success.border.place-top:before{border-top:8px solid #fff}.__react_component_tooltip.type-success.border.place-bottom:before{border-bottom:8px solid #fff}.__react_component_tooltip.type-success.border.place-left:before{border-left:8px solid #fff}.__react_component_tooltip.type-success.border.place-right:before{border-right:8px solid #fff}.__react_component_tooltip.type-warning{color:#fff;background-color:#F0AD4E}.__react_component_tooltip.type-warning.place-top:after{border-top-color:#F0AD4E;border-top-style:solid;border-top-width:6px}.__react_component_tooltip.type-warning.place-bottom:after{border-bottom-color:#F0AD4E;border-bottom-style:solid;border-bottom-width:6px}.__react_component_tooltip.type-warning.place-left:after{border-left-color:#F0AD4E;border-left-style:solid;border-left-width:6px}.__react_component_tooltip.type-warning.place-right:after{border-right-color:#F0AD4E;border-right-style:solid;border-right-width:6px}.__react_component_tooltip.type-warning.border{border:1px solid #fff}.__react_component_tooltip.type-warning.border.place-top:before{border-top:8px solid #fff}.__react_component_tooltip.type-warning.border.place-bottom:before{border-bottom:8px solid #fff}.__react_component_tooltip.type-warning.border.place-left:before{border-left:8px solid #fff}.__react_component_tooltip.type-warning.border.place-right:before{border-right:8px solid #fff}.__react_component_tooltip.type-error{color:#fff;background-color:#BE6464}.__react_component_tooltip.type-error.place-top:after{border-top-color:#BE6464;border-top-style:solid;border-top-width:6px}.__react_component_tooltip.type-error.place-bottom:after{border-bottom-color:#BE6464;border-bottom-style:solid;border-bottom-width:6px}.__react_component_tooltip.type-error.place-left:after{border-left-color:#BE6464;border-left-style:solid;border-left-width:6px}.__react_component_tooltip.type-error.place-right:after{border-right-color:#BE6464;border-right-style:solid;border-right-width:6px}.__react_component_tooltip.type-error.border{border:1px solid #fff}.__react_component_tooltip.type-error.border.place-top:before{border-top:8px solid #fff}.__react_component_tooltip.type-error.border.place-bottom:before{border-bottom:8px solid #fff}.__react_component_tooltip.type-error.border.place-left:before{border-left:8px solid #fff}.__react_component_tooltip.type-error.border.place-right:before{border-right:8px solid #fff}.__react_component_tooltip.type-info{color:#fff;background-color:#337AB7}.__react_component_tooltip.type-info.place-top:after{border-top-color:#337AB7;border-top-style:solid;border-top-width:6px}.__react_component_tooltip.type-info.place-bottom:after{border-bottom-color:#337AB7;border-bottom-style:solid;border-bottom-width:6px}.__react_component_tooltip.type-info.place-left:after{border-left-color:#337AB7;border-left-style:solid;border-left-width:6px}.__react_component_tooltip.type-info.place-right:after{border-right-color:#337AB7;border-right-style:solid;border-right-width:6px}.__react_component_tooltip.type-info.border{border:1px solid #fff}.__react_component_tooltip.type-info.border.place-top:before{border-top:8px solid #fff}.__react_component_tooltip.type-info.border.place-bottom:before{border-bottom:8px solid #fff}.__react_component_tooltip.type-info.border.place-left:before{border-left:8px solid #fff}.__react_component_tooltip.type-info.border.place-right:before{border-right:8px solid #fff}.__react_component_tooltip.type-light{color:#222;background-color:#fff}.__react_component_tooltip.type-light.place-top:after{border-top-color:#fff;border-top-style:solid;border-top-width:6px}.__react_component_tooltip.type-light.place-bottom:after{border-bottom-color:#fff;border-bottom-style:solid;border-bottom-width:6px}.__react_component_tooltip.type-light.place-left:after{border-left-color:#fff;border-left-style:solid;border-left-width:6px}.__react_component_tooltip.type-light.place-right:after{border-right-color:#fff;border-right-style:solid;border-right-width:6px}.__react_component_tooltip.type-light.border{border:1px solid #222}.__react_component_tooltip.type-light.border.place-top:before{border-top:8px solid #222}.__react_component_tooltip.type-light.border.place-bottom:before{border-bottom:8px solid #222}.__react_component_tooltip.type-light.border.place-left:before{border-left:8px solid #222}.__react_component_tooltip.type-light.border.place-right:before{border-right:8px solid #222}.__react_component_tooltip.place-top{margin-top:-10px}.__react_component_tooltip.place-top:before{border-left:10px solid transparent;border-right:10px solid transparent;bottom:-8px;left:50%;margin-left:-10px}.__react_component_tooltip.place-top:after{border-left:8px solid transparent;border-right:8px solid transparent;bottom:-6px;left:50%;margin-left:-8px}.__react_component_tooltip.place-bottom{margin-top:10px}.__react_component_tooltip.place-bottom:before{border-left:10px solid transparent;border-right:10px solid transparent;top:-8px;left:50%;margin-left:-10px}.__react_component_tooltip.place-bottom:after{border-left:8px solid transparent;border-right:8px solid transparent;top:-6px;left:50%;margin-left:-8px}.__react_component_tooltip.place-left{margin-left:-10px}.__react_component_tooltip.place-left:before{border-top:6px solid transparent;border-bottom:6px solid transparent;right:-8px;top:50%;margin-top:-5px}.__react_component_tooltip.place-left:after{border-top:5px solid transparent;border-bottom:5px solid transparent;right:-6px;top:50%;margin-top:-4px}.__react_component_tooltip.place-right{margin-left:10px}.__react_component_tooltip.place-right:before{border-top:6px solid transparent;border-bottom:6px solid transparent;left:-8px;top:50%;margin-top:-5px}.__react_component_tooltip.place-right:after{border-top:5px solid transparent;border-bottom:5px solid transparent;left:-6px;top:50%;margin-top:-4px}.__react_component_tooltip .multi-line{display:block;padding:2px 0px;text-align:center}'},{}],9:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.default=function(e,target,node,place,effect,offset){var tipWidth=node.clientWidth;var tipHeight=node.clientHeight;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);var extraOffset_X=_calculateOffset.extraOffset_X;var extraOffset_Y=_calculateOffset.extraOffset_Y;var widnowWidth=window.innerWidth;var windowHeight=window.innerHeight;var getTipOffsetLeft=function getTipOffsetLeft(place){var offset_X=defaultOffset[place].x;return mouseX+offset_X+extraOffset_X};var getTipOffsetTop=function getTipOffsetTop(place){var offset_Y=defaultOffset[place].y;return mouseY+offset_Y+extraOffset_Y};var outsideLeft=function outsideLeft(){return getTipOffsetLeft("left")<0&&getTipOffsetLeft("right")<=widnowWidth};var outsideRight=function outsideRight(){return getTipOffsetLeft("right")>widnowWidth&&getTipOffsetLeft("left")>=0};var outsideTop=function outsideTop(){return getTipOffsetTop("top")<0&&getTipOffsetTop("bottom")+tipHeight<=windowHeight};var outsideBottom=function outsideBottom(){return getTipOffsetTop("bottom")+tipHeight>windowHeight&&getTipOffsetTop("top")>=0};if(place==="left"&&outsideLeft()){return{isNewState:true,newState:{place:"right"}}}else if(place==="right"&&outsideRight()){return{isNewState:true,newState:{place:"left"}}}else if(place==="top"&&outsideTop()){return{isNewState:true,newState:{place:"bottom"}}}else if(place==="bottom"&&outsideBottom()){return{isNewState:true,newState:{place:"top"}}}return{isNewState:false,position:{left:getTipOffsetLeft(place),top:getTipOffsetTop(place)}}};var getCurrentOffset=function getCurrentOffset(e,currentTarget,effect){var boundingClientRect=currentTarget.getBoundingClientRect();var targetTop=boundingClientRect.top;var targetLeft=boundingClientRect.left;var targetWidth=currentTarget.clientWidth;var targetHeight=currentTarget.clientHeight;if(effect==="float"){return{mouseX:e.clientX,mouseY:e.clientY}}return{mouseX:targetLeft+targetWidth/2,mouseY:targetTop+targetHeight/2}};var getDefaultPosition=function getDefaultPosition(effect,targetWidth,targetHeight,tipWidth,tipHeight){var top=void 0;var right=void 0;var bottom=void 0;var left=void 0;var disToMouse=15;var triangleHeight=5;if(effect==="float"){top={x:-(tipWidth/2),y:-(tipHeight+disToMouse-triangleHeight)};bottom={x:-(tipWidth/2),y:disToMouse};left={x:-(tipWidth+disToMouse-triangleHeight),y:-(tipHeight/2)};right={x:disToMouse,y:-(tipHeight/2)}}else if(effect==="solid"){top={x:-(tipWidth/2),y:-(targetHeight/2+tipHeight)};bottom={x:-(tipWidth/2),y:targetHeight/2};left={x:-(tipWidth+targetWidth/2),y:-(tipHeight/2)};right={x:targetWidth/2,y:-(tipHeight/2)}}return{top:top,bottom:bottom,left:left,right:right}};var calculateOffset=function calculateOffset(offset){var extraOffset_X=0;var extraOffset_Y=0;if(Object.prototype.toString.apply(offset)==="[object String]"){offset=JSON.parse(offset.toString().replace(/\'/g,'"'))}for(var key in offset){if(key==="top"){extraOffset_Y-=parseInt(offset[key],10)}else if(key==="bottom"){extraOffset_Y+=parseInt(offset[key],10)}else if(key==="left"){extraOffset_X-=parseInt(offset[key],10)}else if(key==="right"){extraOffset_X+=parseInt(offset[key],10)}}return{extraOffset_X:extraOffset_X,extraOffset_Y:extraOffset_Y}}},{}],10:[function(require,module,exports){(function(global){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.default=function(tip,children,multiline){if(children)return children;var regexp=//;if(!multiline||multiline==="false"||!regexp.test(tip)){return tip}return tip.split(regexp).map(function(d,i){return _react2.default.createElement("span",{key:i,className:"multi-line"},d)})};var _react=typeof window!=="undefined"?window["React"]:typeof global!=="undefined"?global["React"]:null;var _react2=_interopRequireDefault(_react);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}]},{},[7])(7)}); \ No newline at end of file +(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.ReactTooltip=f()}})(function(){var define,module,exports;return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o0||placeholder){_this5.setState({currentEvent:e,currentTarget:eventTarget,show:true},function(){_this5.updatePosition()})}},delayTime)}},{key:"hideTooltip",value:function hideTooltip(){var _this6=this;var delayHide=this.state.delayHide;if(!this.mount)return;clearTimeout(this.delayShowLoop);clearTimeout(this.delayHideLoop);this.delayHideLoop=setTimeout(function(){_this6.setState({show:false});_this6.removeScrollListener()},parseInt(delayHide,10))}},{key:"addScrollListener",value:function addScrollListener(e){var isCaptureMode=this.isCapture(e.currentTarget);window.addEventListener("scroll",this.hideTooltip.bind(this),isCaptureMode)}},{key:"removeScrollListener",value:function removeScrollListener(){window.removeEventListener("scroll",this.hideTooltip)}},{key:"updatePosition",value:function updatePosition(){var _this7=this;var _state2=this.state;var currentEvent=_state2.currentEvent;var currentTarget=_state2.currentTarget;var place=_state2.place;var effect=_state2.effect;var offset=_state2.offset;var node=_reactDom2.default.findDOMNode(this);var result=(0,_getPosition2.default)(currentEvent,currentTarget,node,place,effect,offset);if(result.isNewState){return this.setState(result.newState,function(){_this7.updatePosition()})}node.style.left=result.position.left+"px";node.style.top=result.position.top+"px"}},{key:"setStyleHeader",value:function setStyleHeader(){if(!document.getElementsByTagName("head")[0].querySelector('style[id="react-tooltip"]')){var tag=document.createElement("style");tag.id="react-tooltip";tag.innerHTML=_style2.default;document.getElementsByTagName("head")[0].appendChild(tag)}}},{key:"render",value:function render(){var _state3=this.state;var placeholder=_state3.placeholder;var extraClass=_state3.extraClass;var html=_state3.html;var tooltipClass=(0,_classnames2.default)("__react_component_tooltip",{show:this.state.show},{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"});if(html){return _react2.default.createElement("div",{className:tooltipClass+" "+extraClass,"data-id":"tooltip",dangerouslySetInnerHTML:{__html:placeholder}})}else{return _react2.default.createElement("div",{className:tooltipClass+" "+extraClass,"data-id":"tooltip"},placeholder)}}}]);return ReactTooltip}(_react.Component),_class2.propTypes={children:_react.PropTypes.any,place:_react.PropTypes.string,type:_react.PropTypes.string,effect:_react.PropTypes.string,offset:_react.PropTypes.object,multiline:_react.PropTypes.bool,border:_react.PropTypes.bool,"class":_react.PropTypes.string,id:_react.PropTypes.string,html:_react.PropTypes.bool,delayHide:_react.PropTypes.number,delayShow:_react.PropTypes.number,event:_react.PropTypes.string,eventOff:_react.PropTypes.string,watchWindow:_react.PropTypes.bool,isCapture:_react.PropTypes.bool,globalEventOff:_react.PropTypes.string},_temp))||_class)||_class)||_class)||_class;module.exports=ReactTooltip}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"./decorators/customEvent":3,"./decorators/isCapture":4,"./decorators/staticMethods":5,"./decorators/windowListener":6,"./style":8,"./utils/getPosition":9,"./utils/getTipContent":10,classnames:1}],8:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.default='.__react_component_tooltip{border-radius:3px;display:inline-block;font-size:13px;left:-999em;opacity:0;padding:8px 21px;position:fixed;pointer-events:none;transition:opacity 0.3s ease-out , margin-top 0.3s ease-out, margin-left 0.3s ease-out;top:-999em;visibility:hidden;z-index:999}.__react_component_tooltip:before,.__react_component_tooltip:after{content:"";width:0;height:0;position:absolute}.__react_component_tooltip.show{opacity:0.9;margin-top:0px;margin-left:0px;visibility:visible}.__react_component_tooltip.type-dark{color:#fff;background-color:#222}.__react_component_tooltip.type-dark.place-top:after{border-top-color:#222;border-top-style:solid;border-top-width:6px}.__react_component_tooltip.type-dark.place-bottom:after{border-bottom-color:#222;border-bottom-style:solid;border-bottom-width:6px}.__react_component_tooltip.type-dark.place-left:after{border-left-color:#222;border-left-style:solid;border-left-width:6px}.__react_component_tooltip.type-dark.place-right:after{border-right-color:#222;border-right-style:solid;border-right-width:6px}.__react_component_tooltip.type-dark.border{border:1px solid #fff}.__react_component_tooltip.type-dark.border.place-top:before{border-top:8px solid #fff}.__react_component_tooltip.type-dark.border.place-bottom:before{border-bottom:8px solid #fff}.__react_component_tooltip.type-dark.border.place-left:before{border-left:8px solid #fff}.__react_component_tooltip.type-dark.border.place-right:before{border-right:8px solid #fff}.__react_component_tooltip.type-success{color:#fff;background-color:#8DC572}.__react_component_tooltip.type-success.place-top:after{border-top-color:#8DC572;border-top-style:solid;border-top-width:6px}.__react_component_tooltip.type-success.place-bottom:after{border-bottom-color:#8DC572;border-bottom-style:solid;border-bottom-width:6px}.__react_component_tooltip.type-success.place-left:after{border-left-color:#8DC572;border-left-style:solid;border-left-width:6px}.__react_component_tooltip.type-success.place-right:after{border-right-color:#8DC572;border-right-style:solid;border-right-width:6px}.__react_component_tooltip.type-success.border{border:1px solid #fff}.__react_component_tooltip.type-success.border.place-top:before{border-top:8px solid #fff}.__react_component_tooltip.type-success.border.place-bottom:before{border-bottom:8px solid #fff}.__react_component_tooltip.type-success.border.place-left:before{border-left:8px solid #fff}.__react_component_tooltip.type-success.border.place-right:before{border-right:8px solid #fff}.__react_component_tooltip.type-warning{color:#fff;background-color:#F0AD4E}.__react_component_tooltip.type-warning.place-top:after{border-top-color:#F0AD4E;border-top-style:solid;border-top-width:6px}.__react_component_tooltip.type-warning.place-bottom:after{border-bottom-color:#F0AD4E;border-bottom-style:solid;border-bottom-width:6px}.__react_component_tooltip.type-warning.place-left:after{border-left-color:#F0AD4E;border-left-style:solid;border-left-width:6px}.__react_component_tooltip.type-warning.place-right:after{border-right-color:#F0AD4E;border-right-style:solid;border-right-width:6px}.__react_component_tooltip.type-warning.border{border:1px solid #fff}.__react_component_tooltip.type-warning.border.place-top:before{border-top:8px solid #fff}.__react_component_tooltip.type-warning.border.place-bottom:before{border-bottom:8px solid #fff}.__react_component_tooltip.type-warning.border.place-left:before{border-left:8px solid #fff}.__react_component_tooltip.type-warning.border.place-right:before{border-right:8px solid #fff}.__react_component_tooltip.type-error{color:#fff;background-color:#BE6464}.__react_component_tooltip.type-error.place-top:after{border-top-color:#BE6464;border-top-style:solid;border-top-width:6px}.__react_component_tooltip.type-error.place-bottom:after{border-bottom-color:#BE6464;border-bottom-style:solid;border-bottom-width:6px}.__react_component_tooltip.type-error.place-left:after{border-left-color:#BE6464;border-left-style:solid;border-left-width:6px}.__react_component_tooltip.type-error.place-right:after{border-right-color:#BE6464;border-right-style:solid;border-right-width:6px}.__react_component_tooltip.type-error.border{border:1px solid #fff}.__react_component_tooltip.type-error.border.place-top:before{border-top:8px solid #fff}.__react_component_tooltip.type-error.border.place-bottom:before{border-bottom:8px solid #fff}.__react_component_tooltip.type-error.border.place-left:before{border-left:8px solid #fff}.__react_component_tooltip.type-error.border.place-right:before{border-right:8px solid #fff}.__react_component_tooltip.type-info{color:#fff;background-color:#337AB7}.__react_component_tooltip.type-info.place-top:after{border-top-color:#337AB7;border-top-style:solid;border-top-width:6px}.__react_component_tooltip.type-info.place-bottom:after{border-bottom-color:#337AB7;border-bottom-style:solid;border-bottom-width:6px}.__react_component_tooltip.type-info.place-left:after{border-left-color:#337AB7;border-left-style:solid;border-left-width:6px}.__react_component_tooltip.type-info.place-right:after{border-right-color:#337AB7;border-right-style:solid;border-right-width:6px}.__react_component_tooltip.type-info.border{border:1px solid #fff}.__react_component_tooltip.type-info.border.place-top:before{border-top:8px solid #fff}.__react_component_tooltip.type-info.border.place-bottom:before{border-bottom:8px solid #fff}.__react_component_tooltip.type-info.border.place-left:before{border-left:8px solid #fff}.__react_component_tooltip.type-info.border.place-right:before{border-right:8px solid #fff}.__react_component_tooltip.type-light{color:#222;background-color:#fff}.__react_component_tooltip.type-light.place-top:after{border-top-color:#fff;border-top-style:solid;border-top-width:6px}.__react_component_tooltip.type-light.place-bottom:after{border-bottom-color:#fff;border-bottom-style:solid;border-bottom-width:6px}.__react_component_tooltip.type-light.place-left:after{border-left-color:#fff;border-left-style:solid;border-left-width:6px}.__react_component_tooltip.type-light.place-right:after{border-right-color:#fff;border-right-style:solid;border-right-width:6px}.__react_component_tooltip.type-light.border{border:1px solid #222}.__react_component_tooltip.type-light.border.place-top:before{border-top:8px solid #222}.__react_component_tooltip.type-light.border.place-bottom:before{border-bottom:8px solid #222}.__react_component_tooltip.type-light.border.place-left:before{border-left:8px solid #222}.__react_component_tooltip.type-light.border.place-right:before{border-right:8px solid #222}.__react_component_tooltip.place-top{margin-top:-10px}.__react_component_tooltip.place-top:before{border-left:10px solid transparent;border-right:10px solid transparent;bottom:-8px;left:50%;margin-left:-10px}.__react_component_tooltip.place-top:after{border-left:8px solid transparent;border-right:8px solid transparent;bottom:-6px;left:50%;margin-left:-8px}.__react_component_tooltip.place-bottom{margin-top:10px}.__react_component_tooltip.place-bottom:before{border-left:10px solid transparent;border-right:10px solid transparent;top:-8px;left:50%;margin-left:-10px}.__react_component_tooltip.place-bottom:after{border-left:8px solid transparent;border-right:8px solid transparent;top:-6px;left:50%;margin-left:-8px}.__react_component_tooltip.place-left{margin-left:-10px}.__react_component_tooltip.place-left:before{border-top:6px solid transparent;border-bottom:6px solid transparent;right:-8px;top:50%;margin-top:-5px}.__react_component_tooltip.place-left:after{border-top:5px solid transparent;border-bottom:5px solid transparent;right:-6px;top:50%;margin-top:-4px}.__react_component_tooltip.place-right{margin-left:10px}.__react_component_tooltip.place-right:before{border-top:6px solid transparent;border-bottom:6px solid transparent;left:-8px;top:50%;margin-top:-5px}.__react_component_tooltip.place-right:after{border-top:5px solid transparent;border-bottom:5px solid transparent;left:-6px;top:50%;margin-top:-4px}.__react_component_tooltip .multi-line{display:block;padding:2px 0px;text-align:center}'},{}],9:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.default=function(e,target,node,place,effect,offset){var tipWidth=node.clientWidth;var tipHeight=node.clientHeight;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);var extraOffset_X=_calculateOffset.extraOffset_X;var extraOffset_Y=_calculateOffset.extraOffset_Y;var widnowWidth=window.innerWidth;var windowHeight=window.innerHeight;var getTipOffsetLeft=function getTipOffsetLeft(place){var offset_X=defaultOffset[place].x;return mouseX+offset_X+extraOffset_X};var getTipOffsetTop=function getTipOffsetTop(place){var offset_Y=defaultOffset[place].y;return mouseY+offset_Y+extraOffset_Y};var outsideLeft=function outsideLeft(){return getTipOffsetLeft("left")<0&&getTipOffsetLeft("right")<=widnowWidth};var outsideRight=function outsideRight(){return getTipOffsetLeft("right")>widnowWidth&&getTipOffsetLeft("left")>=0};var outsideTop=function outsideTop(){return getTipOffsetTop("top")<0&&getTipOffsetTop("bottom")+tipHeight<=windowHeight};var outsideBottom=function outsideBottom(){return getTipOffsetTop("bottom")+tipHeight>windowHeight&&getTipOffsetTop("top")>=0};if(place==="left"&&outsideLeft()){return{isNewState:true,newState:{place:"right"}}}else if(place==="right"&&outsideRight()){return{isNewState:true,newState:{place:"left"}}}else if(place==="top"&&outsideTop()){return{isNewState:true,newState:{place:"bottom"}}}else if(place==="bottom"&&outsideBottom()){return{isNewState:true,newState:{place:"top"}}}return{isNewState:false,position:{left:getTipOffsetLeft(place),top:getTipOffsetTop(place)}}};var getCurrentOffset=function getCurrentOffset(e,currentTarget,effect){var boundingClientRect=currentTarget.getBoundingClientRect();var targetTop=boundingClientRect.top;var targetLeft=boundingClientRect.left;var targetWidth=currentTarget.clientWidth;var targetHeight=currentTarget.clientHeight;if(effect==="float"){return{mouseX:e.clientX,mouseY:e.clientY}}return{mouseX:targetLeft+targetWidth/2,mouseY:targetTop+targetHeight/2}};var getDefaultPosition=function getDefaultPosition(effect,targetWidth,targetHeight,tipWidth,tipHeight){var top=void 0;var right=void 0;var bottom=void 0;var left=void 0;var disToMouse=15;var triangleHeight=5;if(effect==="float"){top={x:-(tipWidth/2),y:-(tipHeight+disToMouse-triangleHeight)};bottom={x:-(tipWidth/2),y:disToMouse};left={x:-(tipWidth+disToMouse-triangleHeight),y:-(tipHeight/2)};right={x:disToMouse,y:-(tipHeight/2)}}else if(effect==="solid"){top={x:-(tipWidth/2),y:-(targetHeight/2+tipHeight)};bottom={x:-(tipWidth/2),y:targetHeight/2};left={x:-(tipWidth+targetWidth/2),y:-(tipHeight/2)};right={x:targetWidth/2,y:-(tipHeight/2)}}return{top:top,bottom:bottom,left:left,right:right}};var calculateOffset=function calculateOffset(offset){var extraOffset_X=0;var extraOffset_Y=0;if(Object.prototype.toString.apply(offset)==="[object String]"){offset=JSON.parse(offset.toString().replace(/\'/g,'"'))}for(var key in offset){if(key==="top"){extraOffset_Y-=parseInt(offset[key],10)}else if(key==="bottom"){extraOffset_Y+=parseInt(offset[key],10)}else if(key==="left"){extraOffset_X-=parseInt(offset[key],10)}else if(key==="right"){extraOffset_X+=parseInt(offset[key],10)}}return{extraOffset_X:extraOffset_X,extraOffset_Y:extraOffset_Y}}},{}],10:[function(require,module,exports){(function(global){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.default=function(tip,children,multiline){if(children)return children;var regexp=//;if(!multiline||multiline==="false"||!regexp.test(tip)){return tip}return tip.split(regexp).map(function(d,i){return _react2.default.createElement("span",{key:i,className:"multi-line"},d)})};var _react=typeof window!=="undefined"?window["React"]:typeof global!=="undefined"?global["React"]:null;var _react2=_interopRequireDefault(_react);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}]},{},[7])(7)}); \ No newline at end of file