react-scrollbar-iframe
Advanced tools
Comparing version 0.3.4 to 0.3.5
@@ -1,2 +0,1475 @@ | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react")):"function"==typeof define&&define.amd?define(["react"],e):"object"==typeof exports?exports.ScrollArea=e(require("react")):t.ScrollArea=e(t.React)}(this,function(t){return function(t){function e(o){if(n[o])return n[o].exports;var i=n[o]={exports:{},id:o,loaded:!1};return t[o].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){"use strict";var o=n(9).default,i=n(10).default,r=n(8).default,s=n(7).default,a=n(6).default,l=n(3).default;Object.defineProperty(e,"__esModule",{value:!0}),n(45);var c=n(5),u=l(c),f=n(16),p=l(f),h=n(17),d=n(43),v=l(d),y=function(t){function e(t){var n=this;s(this,e),o(Object.getPrototypeOf(e.prototype),"constructor",this).call(this,t),this.state={topPosition:0,leftPosition:0,realHeight:0,containerHeight:0,realWidth:0,containerWidth:0},this.scrollArea={refresh:function(){n.setSizesToState()},scrollTop:function(){n.scrollTop()},scrollBottom:function(){n.scrollBottom()},scrollYTo:function(t){n.scrollYTo(t)},scrollLeft:function(){n.scrollLeft()},scrollRight:function(){n.scrollRight()},scrollXTo:function(t){n.scrollXTo(t)}},this.bindedHandleWindowResize=this.handleWindowResize.bind(this)}return i(e,t),r(e,[{key:"getChildContext",value:function(){return{scrollArea:this.scrollArea}}},{key:"componentDidMount",value:function(){this.props.contentWindow.addEventListener("resize",this.bindedHandleWindowResize),this.lineHeightPx=(0,v.default)((0,h.findDOMNode)(this.refs.content)),this.setSizesToState()}},{key:"componentWillUnmount",value:function(){this.props.contentWindow.removeEventListener("resize",this.bindedHandleWindowResize)}},{key:"componentDidUpdate",value:function(){this.setSizesToState()}},{key:"render",value:function(){var t=this.props,e=t.children,n=t.className,o=t.contentClassName,i=t.ownerDocument,r={marginTop:this.state.topPosition,marginLeft:this.state.leftPosition},s=this.canScrollY()?u.default.createElement(p.default,{ownerDocument:i,realSize:this.state.realHeight,containerSize:this.state.containerHeight,position:-this.state.topPosition,onMove:this.handleMove.bind(this),containerStyle:this.props.verticalContainerStyle,scrollbarStyle:this.props.verticalScrollbarStyle,type:"vertical"}):null,l=this.canScrollX()?u.default.createElement(p.default,{ownerDocument:i,realSize:this.state.realWidth,containerSize:this.state.containerWidth,position:-this.state.leftPosition,onMove:this.handleMove.bind(this),containerStyle:this.props.horizontalContainerStyle,scrollbarStyle:this.props.horizontalScrollbarStyle,type:"horizontal"}):null;"function"==typeof e?((0,h.warnAboutFunctionChild)(),e=e()):(0,h.warnAboutElementChild)();var c="scrollarea "+(n||""),f="scrollarea-content "+(o||"");return u.default.createElement("div",{ref:"wrapper",style:this.props.style,className:c,onWheel:this.handleWheel.bind(this)},u.default.createElement("div",{ref:"content",style:a({},this.props.contentStyle,r),className:f,onTouchStart:this.handleTouchStart.bind(this),onTouchMove:this.handleTouchMove.bind(this)},e),s,l)}},{key:"handleTouchStart",value:function(t){var e=t.touches;if(1===e.length){var n=e[0],o=n.clientX,i=n.clientY;this.setState({lastClientYPosition:i,lastClientXPosition:o})}}},{key:"handleTouchMove",value:function(t){t.preventDefault();var e=t.touches;if(1===e.length){var n=e[0],o=n.clientX,i=n.clientY,r=this.state.lastClientYPosition-i,s=this.state.lastClientXPosition-o;this.handleMove(-r,-s),this.setState({lastClientYPosition:i,lastClientXPosition:o})}}},{key:"handleMove",value:function(t,e){var n=this.computeSizes();this.canScrollY(n)&&(n.topPosition=this.computeTopPosition(t,n)),this.canScrollX(n)&&(n.leftPosition=this.computeLeftPosition(e,n)),this.setState(n)}},{key:"handleWheel",value:function(t){var e=this.computeSizes(),n=t.deltaY,o=t.deltaX;1===t.deltaMode&&(n*=this.lineHeightPx,o*=this.lineHeightPx),n*=this.props.speed,o*=this.props.speed,this.canScrollY(e)&&(e.topPosition=this.computeTopPosition(-n,e)),this.canScrollX(e)&&(e.leftPosition=this.computeLeftPosition(-o,e)),(this.state.topPosition!==e.topPosition||this.state.leftPosition!==e.leftPosition)&&t.preventDefault(),this.setState(e)}},{key:"computeTopPosition",value:function(t,e){var n=this.state.topPosition+t;return this.normalizeTopPosition(n,e)}},{key:"computeLeftPosition",value:function(t,e){var n=this.state.leftPosition+t;return this.normalizeLeftPosition(n,e)}},{key:"normalizeTopPosition",value:function(t,e){return-t>e.realHeight-e.containerHeight&&(t=-(e.realHeight-e.containerHeight)),t>0&&(t=0),t}},{key:"normalizeLeftPosition",value:function(t,e){return-t>e.realWidth-e.containerWidth?t=-(e.realWidth-e.containerWidth):t>0&&(t=0),t}},{key:"handleWindowResize",value:function(){var t=this.computeSizes();t=this.getModifiedPositionsIfNeeded(t),this.setState(t)}},{key:"computeSizes",value:function(){var t=(0,h.findDOMNode)(this.refs.content).offsetHeight,e=(0,h.findDOMNode)(this.refs.wrapper).offsetHeight,n=(0,h.findDOMNode)(this.refs.content).offsetWidth,o=(0,h.findDOMNode)(this.refs.wrapper).offsetWidth;return{realHeight:t,containerHeight:e,realWidth:n,containerWidth:o}}},{key:"setSizesToState",value:function(){var t=this.computeSizes();(t.realHeight!==this.state.realHeight||t.realWidth!==this.state.realWidth)&&this.setState(this.getModifiedPositionsIfNeeded(t))}},{key:"scrollTop",value:function(){this.setState({topPosition:0})}},{key:"scrollBottom",value:function(){this.setState({topPosition:-(this.state.realHeight-this.state.containerHeight)})}},{key:"scrollLeft",value:function(){this.setState({leftPosition:0})}},{key:"scrollRight",value:function(){this.setState({leftPosition:-(this.state.realWidth-this.state.containerWidth)})}},{key:"scrollYTo",value:function(t){var e=this.normalizeTopPosition(-t,this.computeSizes());this.setState({topPosition:e})}},{key:"scrollXTo",value:function(t){var e=this.normalizeLeftPosition(-t,this.computeSizes());this.setState({leftPosition:e})}},{key:"canScrollY",value:function(){var t=arguments.length<=0||void 0===arguments[0]?this.state:arguments[0],e=t.realHeight>t.containerHeight||0!=this.state.topPosition;return e&&this.props.vertical}},{key:"canScrollX",value:function(){var t=arguments.length<=0||void 0===arguments[0]?this.state:arguments[0],e=t.realWidth>t.containerWidth||0!=this.state.leftPosition;return e&&this.props.horizontal}},{key:"getModifiedPositionsIfNeeded",value:function(t){var e=t.realHeight-t.containerHeight;-this.state.topPosition>=e&&(t.topPosition=this.canScrollY(t)?-(0,h.positiveOrZero)(e):0);var n=t.realWidth-t.containerWidth;return-this.state.leftPosition>=n&&(t.leftPosition=this.canScrollX(t)?-(0,h.positiveOrZero)(n):0),t}}]),e}(u.default.Component);e.default=y,y.childContextTypes={scrollArea:u.default.PropTypes.object},y.propTypes={className:u.default.PropTypes.string,style:u.default.PropTypes.object,speed:u.default.PropTypes.number,contentClassName:u.default.PropTypes.string,contentStyle:u.default.PropTypes.object,vertical:u.default.PropTypes.bool,verticalContainerStyle:u.default.PropTypes.object,verticalScrollbarStyle:u.default.PropTypes.object,horizontal:u.default.PropTypes.bool,horizontalContainerStyle:u.default.PropTypes.object,horizontalScrollbarStyle:u.default.PropTypes.object,contentWindow:u.default.PropTypes.node,ownerDocument:u.default.PropTypes.node},y.defaultProps={speed:1,vertical:!0,horizontal:!0,contentWindow:window,ownerDocument:document},t.exports=e.default},function(t,e){var n=Object;t.exports={create:n.create,getProto:n.getPrototypeOf,isEnum:{}.propertyIsEnumerable,getDesc:n.getOwnPropertyDescriptor,setDesc:n.defineProperty,setDescs:n.defineProperties,getKeys:n.keys,getNames:n.getOwnPropertyNames,getSymbols:n.getOwnPropertySymbols,each:[].forEach}},function(t,e){var n=t.exports={version:"1.2.6"};"number"==typeof __e&&(__e=n)},function(t,e){"use strict";e.default=function(t){return t&&t.__esModule?t:{"default":t}},e.__esModule=!0},function(t,e,n){var o=n(32),i=n(2),r=n(11),s="prototype",a=function(t,e,n){var l,c,u,f=t&a.F,p=t&a.G,h=t&a.S,d=t&a.P,v=t&a.B,y=t&a.W,g=p?i:i[e]||(i[e]={}),m=p?o:h?o[e]:(o[e]||{})[s];p&&(n=e);for(l in n)c=!f&&m&&l in m,c&&l in g||(u=c?m[l]:n[l],g[l]=p&&"function"!=typeof m[l]?n[l]:v&&c?r(u,o):y&&m[l]==u?function(t){var e=function(e){return this instanceof t?new t(e):t(e)};return e[s]=t[s],e}(u):d&&"function"==typeof u?r(Function.call,u):u,d&&((g[s]||(g[s]={}))[l]=u))};a.F=1,a.G=2,a.S=4,a.P=8,a.B=16,a.W=32,t.exports=a},function(e,n){e.exports=t},function(t,e,n){t.exports={"default":n(24),__esModule:!0}},function(t,e){"use strict";e.default=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},e.__esModule=!0},function(t,e,n){"use strict";var o=n(19).default;e.default=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),o(t,i.key,i)}}return function(e,n,o){return n&&t(e.prototype,n),o&&t(e,o),e}}(),e.__esModule=!0},function(t,e,n){"use strict";var o=n(20).default;e.default=function(t,e,n){for(var i=!0;i;){var r=t,s=e,a=n;i=!1,null===r&&(r=Function.prototype);var l=o(r,s);if(void 0!==l){if("value"in l)return l.value;var c=l.get;if(void 0===c)return;return c.call(a)}var u=Object.getPrototypeOf(r);if(null===u)return;t=u,e=s,n=a,i=!0,l=u=void 0}},e.__esModule=!0},function(t,e,n){"use strict";var o=n(18).default,i=n(21).default;e.default=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=o(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(i?i(t,e):t.__proto__=e)},e.__esModule=!0},function(t,e,n){var o=n(29);t.exports=function(t,e,n){if(o(t),void 0===e)return t;switch(n){case 1:return function(n){return t.call(e,n)};case 2:return function(n,o){return t.call(e,n,o)};case 3:return function(n,o,i){return t.call(e,n,o,i)}}return function(){return t.apply(e,arguments)}}},function(t,e){t.exports=function(t){if(void 0==t)throw TypeError("Can't call method on "+t);return t}},function(t,e){t.exports=function(t){try{return!!t()}catch(e){return!0}}},function(t,e,n){var o=n(31);t.exports=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==o(t)?t.split(""):Object(t)}},function(t,e){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t,e,n){"use strict";var o=n(9).default,i=n(10).default,r=n(8).default,s=n(7).default,a=n(6).default,l=n(3).default;Object.defineProperty(e,"__esModule",{value:!0});var c=n(5),u=l(c),f=n(22),p=l(f),h=function(t){function e(t){s(this,e),o(Object.getPrototypeOf(e.prototype),"constructor",this).call(this,t);var n=this.calculateState(t);this.state={position:n.position,scrollSize:n.scrollSize,isDragging:!1,lastClientPosition:0},"vertical"===t.type?this.bindedHandleMouseMove=this.handleMouseMoveForVertical.bind(this):this.bindedHandleMouseMove=this.handleMouseMoveForHorizontal.bind(this),this.bindedHandleMouseUp=this.handleMouseUp.bind(this)}return i(e,t),r(e,[{key:"componentDidMount",value:function(){this.props.ownerDocument.addEventListener("mousemove",this.bindedHandleMouseMove),this.props.ownerDocument.addEventListener("mouseup",this.bindedHandleMouseUp)}},{key:"componentWillReceiveProps",value:function(t){this.setState(this.calculateState(t))}},{key:"componentWillUnmount",value:function(){this.props.ownerDocument.removeEventListener("mousemove",this.bindedHandleMouseMove),this.props.ownerDocument.removeEventListener("mouseup",this.bindedHandleMouseUp)}},{key:"calculateState",value:function(t){var e=t.containerSize*t.containerSize/t.realSize,n=t.containerSize/t.realSize,o=t.position*n;return{scrollSize:e,position:o}}},{key:"render",value:function(){var t=this.createScrollStyles(),e=(0,p.default)(["scrollbar-container",{active:this.state.isDragging,horizontal:"horizontal"===this.props.type,vertical:"vertical"===this.props.type}]);return u.default.createElement("div",{className:e,style:this.props.containerStyle},u.default.createElement("div",{className:"scrollbar",style:a({},this.props.scrollbarStyle,t),onMouseDown:this.handleMouseDown.bind(this)}))}},{key:"handleMouseMoveForHorizontal",value:function(t){var e=this.props.containerSize/this.props.realSize;if(this.state.isDragging){t.preventDefault();var n=this.state.lastClientPosition-t.clientX;this.setState({lastClientPosition:t.clientX}),this.props.onMove(0,n/e)}}},{key:"handleMouseMoveForVertical",value:function(t){var e=this.props.containerSize/this.props.realSize;if(this.state.isDragging){t.preventDefault();var n=this.state.lastClientPosition-t.clientY;this.setState({lastClientPosition:t.clientY}),this.props.onMove(n/e,0)}}},{key:"handleMouseDown",value:function(t){var e="vertical"===this.props.type?t.clientY:t.clientX;this.setState({isDragging:!0,lastClientPosition:e})}},{key:"handleMouseUp",value:function(t){this.setState({isDragging:!1})}},{key:"createScrollStyles",value:function(){return"vertical"===this.props.type?{height:this.state.scrollSize,marginTop:this.state.position}:{width:this.state.scrollSize,marginLeft:this.state.position}}}]),e}(u.default.Component);h.propTypes={onMove:u.default.PropTypes.func,realSize:u.default.PropTypes.number,containerSize:u.default.PropTypes.number,position:u.default.PropTypes.number,containerStyle:u.default.PropTypes.object,scrollbarStyle:u.default.PropTypes.object,type:u.default.PropTypes.oneOf(["vertical","horizontal"]),ownerDocument:u.default.PropTypes.node},h.defaultProps={type:"vertical",ownerDocument:document},e.default=h,t.exports=e.default},function(t,e,n){"use strict";function o(t){return f?u.default.findDOMNode(t):t}function i(){p||f||(p=!0,console.error("With React 0.14 and later versions, you no longer need to wrap <ScrollArea> child into a function."))}function r(){!p&&f&&(p=!0,console.error("With React 0.13, you need to wrap <ScrollArea> child into a function."))}function s(t){return 0>t?0:t}function a(t){var e=t.version;if("string"!=typeof e)return!0;var n=e.split("."),o=parseInt(n[0],10),i=parseInt(n[1],10);return 0===o&&13===i}var l=n(3).default;Object.defineProperty(e,"__esModule",{value:!0}),e.findDOMNode=o,e.warnAboutFunctionChild=i,e.warnAboutElementChild=r,e.positiveOrZero=s;var c=n(5),u=l(c),f=a(u.default),p=!1},function(t,e,n){t.exports={"default":n(25),__esModule:!0}},function(t,e,n){t.exports={"default":n(26),__esModule:!0}},function(t,e,n){t.exports={"default":n(27),__esModule:!0}},function(t,e,n){t.exports={"default":n(28),__esModule:!0}},function(t,e,n){/*! | ||
(function webpackUniversalModuleDefinition(root, factory) { | ||
if(typeof exports === 'object' && typeof module === 'object') | ||
module.exports = factory(require("react")); | ||
else if(typeof define === 'function' && define.amd) | ||
define(["react"], factory); | ||
else if(typeof exports === 'object') | ||
exports["ScrollArea"] = factory(require("react")); | ||
else | ||
root["ScrollArea"] = factory(root["React"]); | ||
})(this, function(__WEBPACK_EXTERNAL_MODULE_40__) { | ||
return /******/ (function(modules) { // webpackBootstrap | ||
/******/ // The module cache | ||
/******/ var installedModules = {}; | ||
/******/ | ||
/******/ // The require function | ||
/******/ function __webpack_require__(moduleId) { | ||
/******/ | ||
/******/ // Check if module is in cache | ||
/******/ if(installedModules[moduleId]) | ||
/******/ return installedModules[moduleId].exports; | ||
/******/ | ||
/******/ // Create a new module (and put it into the cache) | ||
/******/ var module = installedModules[moduleId] = { | ||
/******/ exports: {}, | ||
/******/ id: moduleId, | ||
/******/ loaded: false | ||
/******/ }; | ||
/******/ | ||
/******/ // Execute the module function | ||
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); | ||
/******/ | ||
/******/ // Flag the module as loaded | ||
/******/ module.loaded = true; | ||
/******/ | ||
/******/ // Return the exports of the module | ||
/******/ return module.exports; | ||
/******/ } | ||
/******/ | ||
/******/ | ||
/******/ // expose the modules object (__webpack_modules__) | ||
/******/ __webpack_require__.m = modules; | ||
/******/ | ||
/******/ // expose the module cache | ||
/******/ __webpack_require__.c = installedModules; | ||
/******/ | ||
/******/ // __webpack_public_path__ | ||
/******/ __webpack_require__.p = ""; | ||
/******/ | ||
/******/ // Load entry module and return exports | ||
/******/ return __webpack_require__(0); | ||
/******/ }) | ||
/************************************************************************/ | ||
/******/ ([ | ||
/* 0 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
'use strict'; | ||
var _get = __webpack_require__(1)['default']; | ||
var _inherits = __webpack_require__(17)['default']; | ||
var _createClass = __webpack_require__(26)['default']; | ||
var _classCallCheck = __webpack_require__(29)['default']; | ||
var _Object$assign = __webpack_require__(30)['default']; | ||
var _interopRequireDefault = __webpack_require__(35)['default']; | ||
Object.defineProperty(exports, '__esModule', { | ||
value: true | ||
}); | ||
__webpack_require__(36); | ||
var _react = __webpack_require__(40); | ||
var _react2 = _interopRequireDefault(_react); | ||
var _scrollBar = __webpack_require__(41); | ||
var _scrollBar2 = _interopRequireDefault(_scrollBar); | ||
var _utils = __webpack_require__(43); | ||
var _lineHeight = __webpack_require__(44); | ||
var _lineHeight2 = _interopRequireDefault(_lineHeight); | ||
var ScrollArea = (function (_React$Component) { | ||
_inherits(ScrollArea, _React$Component); | ||
function ScrollArea(props) { | ||
var _this = this; | ||
_classCallCheck(this, ScrollArea); | ||
_get(Object.getPrototypeOf(ScrollArea.prototype), 'constructor', this).call(this, props); | ||
this.state = { | ||
topPosition: 0, | ||
leftPosition: 0, | ||
realHeight: 0, | ||
containerHeight: 0, | ||
realWidth: 0, | ||
containerWidth: 0 | ||
}; | ||
this.scrollArea = { | ||
refresh: function refresh() { | ||
_this.setSizesToState(); | ||
}, | ||
scrollTop: function scrollTop() { | ||
_this.scrollTop(); | ||
}, | ||
scrollBottom: function scrollBottom() { | ||
_this.scrollBottom(); | ||
}, | ||
scrollYTo: function scrollYTo(position) { | ||
_this.scrollYTo(position); | ||
}, | ||
scrollLeft: function scrollLeft() { | ||
_this.scrollLeft(); | ||
}, | ||
scrollRight: function scrollRight() { | ||
_this.scrollRight(); | ||
}, | ||
scrollXTo: function scrollXTo(position) { | ||
_this.scrollXTo(position); | ||
} | ||
}; | ||
this.bindedHandleWindowResize = this.handleWindowResize.bind(this); | ||
} | ||
_createClass(ScrollArea, [{ | ||
key: 'getChildContext', | ||
value: function getChildContext() { | ||
return { | ||
scrollArea: this.scrollArea | ||
}; | ||
} | ||
}, { | ||
key: 'componentDidMount', | ||
value: function componentDidMount() { | ||
this.props.contentWindow.addEventListener("resize", this.bindedHandleWindowResize); | ||
this.lineHeightPx = (0, _lineHeight2['default'])((0, _utils.findDOMNode)(this.refs.content)); | ||
this.setSizesToState(); | ||
} | ||
}, { | ||
key: 'componentWillUnmount', | ||
value: function componentWillUnmount() { | ||
this.props.contentWindow.removeEventListener("resize", this.bindedHandleWindowResize); | ||
} | ||
}, { | ||
key: 'componentDidUpdate', | ||
value: function componentDidUpdate() { | ||
this.setSizesToState(); | ||
} | ||
}, { | ||
key: 'render', | ||
value: function render() { | ||
var _props = this.props; | ||
var children = _props.children; | ||
var className = _props.className; | ||
var contentClassName = _props.contentClassName; | ||
var ownerDocument = _props.ownerDocument; | ||
var contentStyle = { | ||
marginTop: this.state.topPosition, | ||
marginLeft: this.state.leftPosition | ||
}; | ||
var scrollbarY = this.canScrollY() ? _react2['default'].createElement(_scrollBar2['default'], { | ||
ownerDocument: ownerDocument, | ||
realSize: this.state.realHeight, | ||
containerSize: this.state.containerHeight, | ||
position: -this.state.topPosition, | ||
onMove: this.handleMove.bind(this), | ||
containerStyle: this.props.verticalContainerStyle, | ||
scrollbarStyle: this.props.verticalScrollbarStyle, | ||
type: 'vertical' }) : null; | ||
var scrollbarX = this.canScrollX() ? _react2['default'].createElement(_scrollBar2['default'], { | ||
ownerDocument: ownerDocument, | ||
realSize: this.state.realWidth, | ||
containerSize: this.state.containerWidth, | ||
position: -this.state.leftPosition, | ||
onMove: this.handleMove.bind(this), | ||
containerStyle: this.props.horizontalContainerStyle, | ||
scrollbarStyle: this.props.horizontalScrollbarStyle, | ||
type: 'horizontal' }) : null; | ||
if (typeof children === 'function') { | ||
(0, _utils.warnAboutFunctionChild)(); | ||
children = children(); | ||
} else { | ||
(0, _utils.warnAboutElementChild)(); | ||
} | ||
var classes = 'scrollarea ' + (className || ''); | ||
var contentClasses = 'scrollarea-content ' + (contentClassName || ''); | ||
return _react2['default'].createElement( | ||
'div', | ||
{ ref: 'wrapper', style: this.props.style, className: classes, onWheel: this.handleWheel.bind(this) }, | ||
_react2['default'].createElement( | ||
'div', | ||
{ ref: 'content', | ||
style: _Object$assign({}, this.props.contentStyle, contentStyle), | ||
className: contentClasses, | ||
onTouchStart: this.handleTouchStart.bind(this), | ||
onTouchMove: this.handleTouchMove.bind(this) }, | ||
children | ||
), | ||
scrollbarY, | ||
scrollbarX | ||
); | ||
} | ||
}, { | ||
key: 'handleTouchStart', | ||
value: function handleTouchStart(e) { | ||
var touches = e.touches; | ||
if (touches.length === 1) { | ||
var _touches$0 = touches[0]; | ||
var clientX = _touches$0.clientX; | ||
var clientY = _touches$0.clientY; | ||
this.setState({ lastClientYPosition: clientY, lastClientXPosition: clientX }); | ||
} | ||
} | ||
}, { | ||
key: 'handleTouchMove', | ||
value: function handleTouchMove(e) { | ||
e.preventDefault(); | ||
var touches = e.touches; | ||
if (touches.length === 1) { | ||
var _touches$02 = touches[0]; | ||
var clientX = _touches$02.clientX; | ||
var clientY = _touches$02.clientY; | ||
var deltaY = this.state.lastClientYPosition - clientY; | ||
var deltaX = this.state.lastClientXPosition - clientX; | ||
this.handleMove(-deltaY, -deltaX); | ||
this.setState({ lastClientYPosition: clientY, lastClientXPosition: clientX }); | ||
} | ||
} | ||
}, { | ||
key: 'handleMove', | ||
value: function handleMove(deltaY, deltaX) { | ||
var newState = this.computeSizes(); | ||
if (this.canScrollY(newState)) { | ||
newState.topPosition = this.computeTopPosition(deltaY, newState); | ||
} | ||
if (this.canScrollX(newState)) { | ||
newState.leftPosition = this.computeLeftPosition(deltaX, newState); | ||
} | ||
this.setState(newState); | ||
} | ||
}, { | ||
key: 'handleWheel', | ||
value: function handleWheel(e) { | ||
var newState = this.computeSizes(); | ||
var deltaY = e.deltaY; | ||
var deltaX = e.deltaX; | ||
/* | ||
* WheelEvent.deltaMode can differ between browsers and must be normalized | ||
* e.deltaMode === 0: The delta values are specified in pixels | ||
* e.deltaMode === 1: The delta values are specified in lines | ||
* https://developer.mozilla.org/en-US/docs/Web/API/WheelEvent/deltaMode | ||
*/ | ||
if (e.deltaMode === 1) { | ||
deltaY = deltaY * this.lineHeightPx; | ||
deltaX = deltaX * this.lineHeightPx; | ||
} | ||
deltaY = deltaY * this.props.speed; | ||
deltaX = deltaX * this.props.speed; | ||
if (this.canScrollY(newState)) { | ||
newState.topPosition = this.computeTopPosition(-deltaY, newState); | ||
} | ||
if (this.canScrollX(newState)) { | ||
newState.leftPosition = this.computeLeftPosition(-deltaX, newState); | ||
} | ||
if (this.state.topPosition !== newState.topPosition || this.state.leftPosition !== newState.leftPosition) { | ||
e.preventDefault(); | ||
} | ||
this.setState(newState); | ||
} | ||
}, { | ||
key: 'computeTopPosition', | ||
value: function computeTopPosition(deltaY, sizes) { | ||
var newTopPosition = this.state.topPosition + deltaY; | ||
return this.normalizeTopPosition(newTopPosition, sizes); | ||
} | ||
}, { | ||
key: 'computeLeftPosition', | ||
value: function computeLeftPosition(deltaX, sizes) { | ||
var newLeftPosition = this.state.leftPosition + deltaX; | ||
return this.normalizeLeftPosition(newLeftPosition, sizes); | ||
} | ||
}, { | ||
key: 'normalizeTopPosition', | ||
value: function normalizeTopPosition(newTopPosition, sizes) { | ||
if (-newTopPosition > sizes.realHeight - sizes.containerHeight) { | ||
newTopPosition = -(sizes.realHeight - sizes.containerHeight); | ||
} | ||
if (newTopPosition > 0) { | ||
newTopPosition = 0; | ||
} | ||
return newTopPosition; | ||
} | ||
}, { | ||
key: 'normalizeLeftPosition', | ||
value: function normalizeLeftPosition(newLeftPosition, sizes) { | ||
if (-newLeftPosition > sizes.realWidth - sizes.containerWidth) { | ||
newLeftPosition = -(sizes.realWidth - sizes.containerWidth); | ||
} else if (newLeftPosition > 0) { | ||
newLeftPosition = 0; | ||
} | ||
return newLeftPosition; | ||
} | ||
}, { | ||
key: 'handleWindowResize', | ||
value: function handleWindowResize() { | ||
var newState = this.computeSizes(); | ||
newState = this.getModifiedPositionsIfNeeded(newState); | ||
this.setState(newState); | ||
} | ||
}, { | ||
key: 'computeSizes', | ||
value: function computeSizes() { | ||
var realHeight = (0, _utils.findDOMNode)(this.refs.content).offsetHeight; | ||
var containerHeight = (0, _utils.findDOMNode)(this.refs.wrapper).offsetHeight; | ||
var realWidth = (0, _utils.findDOMNode)(this.refs.content).offsetWidth; | ||
var containerWidth = (0, _utils.findDOMNode)(this.refs.wrapper).offsetWidth; | ||
return { | ||
realHeight: realHeight, | ||
containerHeight: containerHeight, | ||
realWidth: realWidth, | ||
containerWidth: containerWidth | ||
}; | ||
} | ||
}, { | ||
key: 'setSizesToState', | ||
value: function setSizesToState() { | ||
var sizes = this.computeSizes(); | ||
if (sizes.realHeight !== this.state.realHeight || sizes.realWidth !== this.state.realWidth) { | ||
this.setState(this.getModifiedPositionsIfNeeded(sizes)); | ||
} | ||
} | ||
}, { | ||
key: 'scrollTop', | ||
value: function scrollTop() { | ||
this.setState({ topPosition: 0 }); | ||
} | ||
}, { | ||
key: 'scrollBottom', | ||
value: function scrollBottom() { | ||
this.setState({ topPosition: -(this.state.realHeight - this.state.containerHeight) }); | ||
} | ||
}, { | ||
key: 'scrollLeft', | ||
value: function scrollLeft() { | ||
this.setState({ leftPosition: 0 }); | ||
} | ||
}, { | ||
key: 'scrollRight', | ||
value: function scrollRight() { | ||
this.setState({ leftPosition: -(this.state.realWidth - this.state.containerWidth) }); | ||
} | ||
}, { | ||
key: 'scrollYTo', | ||
value: function scrollYTo(topPosition) { | ||
var position = this.normalizeTopPosition(-topPosition, this.computeSizes()); | ||
this.setState({ topPosition: position }); | ||
} | ||
}, { | ||
key: 'scrollXTo', | ||
value: function scrollXTo(leftPosition) { | ||
var position = this.normalizeLeftPosition(-leftPosition, this.computeSizes()); | ||
this.setState({ leftPosition: position }); | ||
} | ||
}, { | ||
key: 'canScrollY', | ||
value: function canScrollY() { | ||
var state = arguments.length <= 0 || arguments[0] === undefined ? this.state : arguments[0]; | ||
var scrollableY = state.realHeight > state.containerHeight || this.state.topPosition != 0; | ||
return scrollableY && this.props.vertical; | ||
} | ||
}, { | ||
key: 'canScrollX', | ||
value: function canScrollX() { | ||
var state = arguments.length <= 0 || arguments[0] === undefined ? this.state : arguments[0]; | ||
var scrollableX = state.realWidth > state.containerWidth || this.state.leftPosition != 0; | ||
return scrollableX && this.props.horizontal; | ||
} | ||
}, { | ||
key: 'getModifiedPositionsIfNeeded', | ||
value: function getModifiedPositionsIfNeeded(newState) { | ||
var bottomPosition = newState.realHeight - newState.containerHeight; | ||
if (-this.state.topPosition >= bottomPosition) { | ||
newState.topPosition = this.canScrollY(newState) ? -(0, _utils.positiveOrZero)(bottomPosition) : 0; | ||
} | ||
var rightPosition = newState.realWidth - newState.containerWidth; | ||
if (-this.state.leftPosition >= rightPosition) { | ||
newState.leftPosition = this.canScrollX(newState) ? -(0, _utils.positiveOrZero)(rightPosition) : 0; | ||
} | ||
return newState; | ||
} | ||
}]); | ||
return ScrollArea; | ||
})(_react2['default'].Component); | ||
exports['default'] = ScrollArea; | ||
ScrollArea.childContextTypes = { | ||
scrollArea: _react2['default'].PropTypes.object | ||
}; | ||
ScrollArea.propTypes = { | ||
className: _react2['default'].PropTypes.string, | ||
style: _react2['default'].PropTypes.object, | ||
speed: _react2['default'].PropTypes.number, | ||
contentClassName: _react2['default'].PropTypes.string, | ||
contentStyle: _react2['default'].PropTypes.object, | ||
vertical: _react2['default'].PropTypes.bool, | ||
verticalContainerStyle: _react2['default'].PropTypes.object, | ||
verticalScrollbarStyle: _react2['default'].PropTypes.object, | ||
horizontal: _react2['default'].PropTypes.bool, | ||
horizontalContainerStyle: _react2['default'].PropTypes.object, | ||
horizontalScrollbarStyle: _react2['default'].PropTypes.object, | ||
contentWindow: _react2['default'].PropTypes.any, | ||
ownerDocument: _react2['default'].PropTypes.any | ||
}; | ||
ScrollArea.defaultProps = { | ||
speed: 1, | ||
vertical: true, | ||
horizontal: true, | ||
contentWindow: window, | ||
ownerDocument: document | ||
}; | ||
module.exports = exports['default']; | ||
/***/ }, | ||
/* 1 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
var _Object$getOwnPropertyDescriptor = __webpack_require__(2)["default"]; | ||
exports["default"] = function get(_x, _x2, _x3) { | ||
var _again = true; | ||
_function: while (_again) { | ||
var object = _x, | ||
property = _x2, | ||
receiver = _x3; | ||
_again = false; | ||
if (object === null) object = Function.prototype; | ||
var desc = _Object$getOwnPropertyDescriptor(object, property); | ||
if (desc === undefined) { | ||
var parent = Object.getPrototypeOf(object); | ||
if (parent === null) { | ||
return undefined; | ||
} else { | ||
_x = parent; | ||
_x2 = property; | ||
_x3 = receiver; | ||
_again = true; | ||
desc = parent = undefined; | ||
continue _function; | ||
} | ||
} else if ("value" in desc) { | ||
return desc.value; | ||
} else { | ||
var getter = desc.get; | ||
if (getter === undefined) { | ||
return undefined; | ||
} | ||
return getter.call(receiver); | ||
} | ||
} | ||
}; | ||
exports.__esModule = true; | ||
/***/ }, | ||
/* 2 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
module.exports = { "default": __webpack_require__(3), __esModule: true }; | ||
/***/ }, | ||
/* 3 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
var $ = __webpack_require__(4); | ||
__webpack_require__(5); | ||
module.exports = function getOwnPropertyDescriptor(it, key){ | ||
return $.getDesc(it, key); | ||
}; | ||
/***/ }, | ||
/* 4 */ | ||
/***/ function(module, exports) { | ||
var $Object = Object; | ||
module.exports = { | ||
create: $Object.create, | ||
getProto: $Object.getPrototypeOf, | ||
isEnum: {}.propertyIsEnumerable, | ||
getDesc: $Object.getOwnPropertyDescriptor, | ||
setDesc: $Object.defineProperty, | ||
setDescs: $Object.defineProperties, | ||
getKeys: $Object.keys, | ||
getNames: $Object.getOwnPropertyNames, | ||
getSymbols: $Object.getOwnPropertySymbols, | ||
each: [].forEach | ||
}; | ||
/***/ }, | ||
/* 5 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
// 19.1.2.6 Object.getOwnPropertyDescriptor(O, P) | ||
var toIObject = __webpack_require__(6); | ||
__webpack_require__(10)('getOwnPropertyDescriptor', function($getOwnPropertyDescriptor){ | ||
return function getOwnPropertyDescriptor(it, key){ | ||
return $getOwnPropertyDescriptor(toIObject(it), key); | ||
}; | ||
}); | ||
/***/ }, | ||
/* 6 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
// to indexed object, toObject with fallback for non-array-like ES3 strings | ||
var IObject = __webpack_require__(7) | ||
, defined = __webpack_require__(9); | ||
module.exports = function(it){ | ||
return IObject(defined(it)); | ||
}; | ||
/***/ }, | ||
/* 7 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
// fallback for non-array-like ES3 and non-enumerable old V8 strings | ||
var cof = __webpack_require__(8); | ||
module.exports = Object('z').propertyIsEnumerable(0) ? Object : function(it){ | ||
return cof(it) == 'String' ? it.split('') : Object(it); | ||
}; | ||
/***/ }, | ||
/* 8 */ | ||
/***/ function(module, exports) { | ||
var toString = {}.toString; | ||
module.exports = function(it){ | ||
return toString.call(it).slice(8, -1); | ||
}; | ||
/***/ }, | ||
/* 9 */ | ||
/***/ function(module, exports) { | ||
// 7.2.1 RequireObjectCoercible(argument) | ||
module.exports = function(it){ | ||
if(it == undefined)throw TypeError("Can't call method on " + it); | ||
return it; | ||
}; | ||
/***/ }, | ||
/* 10 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
// most Object methods by ES6 should accept primitives | ||
var $export = __webpack_require__(11) | ||
, core = __webpack_require__(13) | ||
, fails = __webpack_require__(16); | ||
module.exports = function(KEY, exec){ | ||
var fn = (core.Object || {})[KEY] || Object[KEY] | ||
, exp = {}; | ||
exp[KEY] = exec(fn); | ||
$export($export.S + $export.F * fails(function(){ fn(1); }), 'Object', exp); | ||
}; | ||
/***/ }, | ||
/* 11 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
var global = __webpack_require__(12) | ||
, core = __webpack_require__(13) | ||
, ctx = __webpack_require__(14) | ||
, PROTOTYPE = 'prototype'; | ||
var $export = function(type, name, source){ | ||
var IS_FORCED = type & $export.F | ||
, IS_GLOBAL = type & $export.G | ||
, IS_STATIC = type & $export.S | ||
, IS_PROTO = type & $export.P | ||
, IS_BIND = type & $export.B | ||
, IS_WRAP = type & $export.W | ||
, exports = IS_GLOBAL ? core : core[name] || (core[name] = {}) | ||
, target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE] | ||
, key, own, out; | ||
if(IS_GLOBAL)source = name; | ||
for(key in source){ | ||
// contains in native | ||
own = !IS_FORCED && target && key in target; | ||
if(own && key in exports)continue; | ||
// export native or passed | ||
out = own ? target[key] : source[key]; | ||
// prevent global pollution for namespaces | ||
exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key] | ||
// bind timers to global for call from export context | ||
: IS_BIND && own ? ctx(out, global) | ||
// wrap global constructors for prevent change them in library | ||
: IS_WRAP && target[key] == out ? (function(C){ | ||
var F = function(param){ | ||
return this instanceof C ? new C(param) : C(param); | ||
}; | ||
F[PROTOTYPE] = C[PROTOTYPE]; | ||
return F; | ||
// make static versions for prototype methods | ||
})(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out; | ||
if(IS_PROTO)(exports[PROTOTYPE] || (exports[PROTOTYPE] = {}))[key] = out; | ||
} | ||
}; | ||
// type bitmap | ||
$export.F = 1; // forced | ||
$export.G = 2; // global | ||
$export.S = 4; // static | ||
$export.P = 8; // proto | ||
$export.B = 16; // bind | ||
$export.W = 32; // wrap | ||
module.exports = $export; | ||
/***/ }, | ||
/* 12 */ | ||
/***/ function(module, exports) { | ||
// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 | ||
var global = module.exports = typeof window != 'undefined' && window.Math == Math | ||
? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')(); | ||
if(typeof __g == 'number')__g = global; // eslint-disable-line no-undef | ||
/***/ }, | ||
/* 13 */ | ||
/***/ function(module, exports) { | ||
var core = module.exports = {version: '1.2.6'}; | ||
if(typeof __e == 'number')__e = core; // eslint-disable-line no-undef | ||
/***/ }, | ||
/* 14 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
// optional / simple context binding | ||
var aFunction = __webpack_require__(15); | ||
module.exports = function(fn, that, length){ | ||
aFunction(fn); | ||
if(that === undefined)return fn; | ||
switch(length){ | ||
case 1: return function(a){ | ||
return fn.call(that, a); | ||
}; | ||
case 2: return function(a, b){ | ||
return fn.call(that, a, b); | ||
}; | ||
case 3: return function(a, b, c){ | ||
return fn.call(that, a, b, c); | ||
}; | ||
} | ||
return function(/* ...args */){ | ||
return fn.apply(that, arguments); | ||
}; | ||
}; | ||
/***/ }, | ||
/* 15 */ | ||
/***/ function(module, exports) { | ||
module.exports = function(it){ | ||
if(typeof it != 'function')throw TypeError(it + ' is not a function!'); | ||
return it; | ||
}; | ||
/***/ }, | ||
/* 16 */ | ||
/***/ function(module, exports) { | ||
module.exports = function(exec){ | ||
try { | ||
return !!exec(); | ||
} catch(e){ | ||
return true; | ||
} | ||
}; | ||
/***/ }, | ||
/* 17 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
var _Object$create = __webpack_require__(18)["default"]; | ||
var _Object$setPrototypeOf = __webpack_require__(20)["default"]; | ||
exports["default"] = function (subClass, superClass) { | ||
if (typeof superClass !== "function" && superClass !== null) { | ||
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); | ||
} | ||
subClass.prototype = _Object$create(superClass && superClass.prototype, { | ||
constructor: { | ||
value: subClass, | ||
enumerable: false, | ||
writable: true, | ||
configurable: true | ||
} | ||
}); | ||
if (superClass) _Object$setPrototypeOf ? _Object$setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; | ||
}; | ||
exports.__esModule = true; | ||
/***/ }, | ||
/* 18 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
module.exports = { "default": __webpack_require__(19), __esModule: true }; | ||
/***/ }, | ||
/* 19 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
var $ = __webpack_require__(4); | ||
module.exports = function create(P, D){ | ||
return $.create(P, D); | ||
}; | ||
/***/ }, | ||
/* 20 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
module.exports = { "default": __webpack_require__(21), __esModule: true }; | ||
/***/ }, | ||
/* 21 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
__webpack_require__(22); | ||
module.exports = __webpack_require__(13).Object.setPrototypeOf; | ||
/***/ }, | ||
/* 22 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
// 19.1.3.19 Object.setPrototypeOf(O, proto) | ||
var $export = __webpack_require__(11); | ||
$export($export.S, 'Object', {setPrototypeOf: __webpack_require__(23).set}); | ||
/***/ }, | ||
/* 23 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
// Works with __proto__ only. Old v8 can't work with null proto objects. | ||
/* eslint-disable no-proto */ | ||
var getDesc = __webpack_require__(4).getDesc | ||
, isObject = __webpack_require__(24) | ||
, anObject = __webpack_require__(25); | ||
var check = function(O, proto){ | ||
anObject(O); | ||
if(!isObject(proto) && proto !== null)throw TypeError(proto + ": can't set as prototype!"); | ||
}; | ||
module.exports = { | ||
set: Object.setPrototypeOf || ('__proto__' in {} ? // eslint-disable-line | ||
function(test, buggy, set){ | ||
try { | ||
set = __webpack_require__(14)(Function.call, getDesc(Object.prototype, '__proto__').set, 2); | ||
set(test, []); | ||
buggy = !(test instanceof Array); | ||
} catch(e){ buggy = true; } | ||
return function setPrototypeOf(O, proto){ | ||
check(O, proto); | ||
if(buggy)O.__proto__ = proto; | ||
else set(O, proto); | ||
return O; | ||
}; | ||
}({}, false) : undefined), | ||
check: check | ||
}; | ||
/***/ }, | ||
/* 24 */ | ||
/***/ function(module, exports) { | ||
module.exports = function(it){ | ||
return typeof it === 'object' ? it !== null : typeof it === 'function'; | ||
}; | ||
/***/ }, | ||
/* 25 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
var isObject = __webpack_require__(24); | ||
module.exports = function(it){ | ||
if(!isObject(it))throw TypeError(it + ' is not an object!'); | ||
return it; | ||
}; | ||
/***/ }, | ||
/* 26 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
var _Object$defineProperty = __webpack_require__(27)["default"]; | ||
exports["default"] = (function () { | ||
function defineProperties(target, props) { | ||
for (var i = 0; i < props.length; i++) { | ||
var descriptor = props[i]; | ||
descriptor.enumerable = descriptor.enumerable || false; | ||
descriptor.configurable = true; | ||
if ("value" in descriptor) descriptor.writable = true; | ||
_Object$defineProperty(target, descriptor.key, descriptor); | ||
} | ||
} | ||
return function (Constructor, protoProps, staticProps) { | ||
if (protoProps) defineProperties(Constructor.prototype, protoProps); | ||
if (staticProps) defineProperties(Constructor, staticProps); | ||
return Constructor; | ||
}; | ||
})(); | ||
exports.__esModule = true; | ||
/***/ }, | ||
/* 27 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
module.exports = { "default": __webpack_require__(28), __esModule: true }; | ||
/***/ }, | ||
/* 28 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
var $ = __webpack_require__(4); | ||
module.exports = function defineProperty(it, key, desc){ | ||
return $.setDesc(it, key, desc); | ||
}; | ||
/***/ }, | ||
/* 29 */ | ||
/***/ function(module, exports) { | ||
"use strict"; | ||
exports["default"] = function (instance, Constructor) { | ||
if (!(instance instanceof Constructor)) { | ||
throw new TypeError("Cannot call a class as a function"); | ||
} | ||
}; | ||
exports.__esModule = true; | ||
/***/ }, | ||
/* 30 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
module.exports = { "default": __webpack_require__(31), __esModule: true }; | ||
/***/ }, | ||
/* 31 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
__webpack_require__(32); | ||
module.exports = __webpack_require__(13).Object.assign; | ||
/***/ }, | ||
/* 32 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
// 19.1.3.1 Object.assign(target, source) | ||
var $export = __webpack_require__(11); | ||
$export($export.S + $export.F, 'Object', {assign: __webpack_require__(33)}); | ||
/***/ }, | ||
/* 33 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
// 19.1.2.1 Object.assign(target, source, ...) | ||
var $ = __webpack_require__(4) | ||
, toObject = __webpack_require__(34) | ||
, IObject = __webpack_require__(7); | ||
// should work with symbols and should have deterministic property order (V8 bug) | ||
module.exports = __webpack_require__(16)(function(){ | ||
var a = Object.assign | ||
, A = {} | ||
, B = {} | ||
, S = Symbol() | ||
, K = 'abcdefghijklmnopqrst'; | ||
A[S] = 7; | ||
K.split('').forEach(function(k){ B[k] = k; }); | ||
return a({}, A)[S] != 7 || Object.keys(a({}, B)).join('') != K; | ||
}) ? function assign(target, source){ // eslint-disable-line no-unused-vars | ||
var T = toObject(target) | ||
, $$ = arguments | ||
, $$len = $$.length | ||
, index = 1 | ||
, getKeys = $.getKeys | ||
, getSymbols = $.getSymbols | ||
, isEnum = $.isEnum; | ||
while($$len > index){ | ||
var S = IObject($$[index++]) | ||
, keys = getSymbols ? getKeys(S).concat(getSymbols(S)) : getKeys(S) | ||
, length = keys.length | ||
, j = 0 | ||
, key; | ||
while(length > j)if(isEnum.call(S, key = keys[j++]))T[key] = S[key]; | ||
} | ||
return T; | ||
} : Object.assign; | ||
/***/ }, | ||
/* 34 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
// 7.1.13 ToObject(argument) | ||
var defined = __webpack_require__(9); | ||
module.exports = function(it){ | ||
return Object(defined(it)); | ||
}; | ||
/***/ }, | ||
/* 35 */ | ||
/***/ function(module, exports) { | ||
"use strict"; | ||
exports["default"] = function (obj) { | ||
return obj && obj.__esModule ? obj : { | ||
"default": obj | ||
}; | ||
}; | ||
exports.__esModule = true; | ||
/***/ }, | ||
/* 36 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
// style-loader: Adds some css to the DOM by adding a <style> tag | ||
// load the styles | ||
var content = __webpack_require__(37); | ||
if(typeof content === 'string') content = [[module.id, content, '']]; | ||
// add the styles to the DOM | ||
var update = __webpack_require__(39)(content, {}); | ||
// Hot Module Replacement | ||
if(false) { | ||
// When the styles change, update the <style> tags | ||
module.hot.accept("!!./../../node_modules/css-loader/index.js!./../../node_modules/less-loader/index.js!./scrollbar.less", function() { | ||
var newContent = require("!!./../../node_modules/css-loader/index.js!./../../node_modules/less-loader/index.js!./scrollbar.less"); | ||
if(typeof newContent === 'string') newContent = [[module.id, newContent, '']]; | ||
update(newContent); | ||
}); | ||
// When the module is disposed, remove the <style> tags | ||
module.hot.dispose(function() { update(); }); | ||
} | ||
/***/ }, | ||
/* 37 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
exports = module.exports = __webpack_require__(38)(); | ||
exports.push([module.id, ".scrollarea-content {\n margin: 0;\n padding: 0;\n overflow: hidden;\n position: relative;\n}\n.scrollarea {\n position: relative;\n overflow: hidden;\n}\n.scrollarea .scrollbar-container {\n position: absolute;\n background: none;\n opacity: .1;\n z-index: 9999;\n -webkit-transition: all .4s;\n -moz-transition: all .4s;\n -ms-transition: all .4s;\n -o-transition: all .4s;\n transition: all .4s;\n}\n.scrollarea .scrollbar-container.horizontal {\n width: 100%;\n height: 10px;\n left: 0;\n bottom: 0;\n}\n.scrollarea .scrollbar-container.horizontal .scrollbar {\n width: 20px;\n height: 8px;\n background: black;\n margin-top: 1px;\n}\n.scrollarea .scrollbar-container.vertical {\n width: 10px;\n height: 100%;\n right: 0;\n top: 0;\n}\n.scrollarea .scrollbar-container.vertical .scrollbar {\n width: 8px;\n height: 20px;\n background: black;\n margin-left: 1px;\n}\n.scrollarea .scrollbar-container:hover {\n background: gray;\n opacity: .6 !important;\n}\n.scrollarea .scrollbar-container.active {\n background: gray;\n opacity: .6 !important;\n}\n.scrollarea:hover .scrollbar-container {\n opacity: .3;\n}\n", ""]); | ||
/***/ }, | ||
/* 38 */ | ||
/***/ function(module, exports) { | ||
/* | ||
MIT License http://www.opensource.org/licenses/mit-license.php | ||
Author Tobias Koppers @sokra | ||
*/ | ||
// css base code, injected by the css-loader | ||
// | ||
module.exports = function() { | ||
var list = []; | ||
// return the list of modules as css string | ||
list.toString = function toString() { | ||
var result = []; | ||
for(var i = 0; i < this.length; i++) { | ||
var item = this[i]; | ||
if(item[2]) { | ||
result.push("@media " + item[2] + "{" + item[1] + "}"); | ||
} else { | ||
result.push(item[1]); | ||
} | ||
} | ||
return result.join(""); | ||
}; | ||
// import a list of modules into the list | ||
list.i = function(modules, mediaQuery) { | ||
if(typeof modules === "string") | ||
modules = [[null, modules, ""]]; | ||
var alreadyImportedModules = {}; | ||
for(var i = 0; i < this.length; i++) { | ||
var id = this[i][0]; | ||
if(typeof id === "number") | ||
alreadyImportedModules[id] = true; | ||
} | ||
for(var i = 0; i < modules.length; i++) { | ||
var item = modules[i]; | ||
// skip already imported module | ||
// this implementation is not 100% perfect for weird media query combinations | ||
// when a module is imported multiple times with different media queries. | ||
// I hope this will never occur (Hey this way we have smaller bundles) | ||
if(typeof item[0] !== "number" || !alreadyImportedModules[item[0]]) { | ||
if(mediaQuery && !item[2]) { | ||
item[2] = mediaQuery; | ||
} else if(mediaQuery) { | ||
item[2] = "(" + item[2] + ") and (" + mediaQuery + ")"; | ||
} | ||
list.push(item); | ||
} | ||
} | ||
}; | ||
return list; | ||
}; | ||
/***/ }, | ||
/* 39 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
/* | ||
MIT License http://www.opensource.org/licenses/mit-license.php | ||
Author Tobias Koppers @sokra | ||
*/ | ||
var stylesInDom = {}, | ||
memoize = function(fn) { | ||
var memo; | ||
return function () { | ||
if (typeof memo === "undefined") memo = fn.apply(this, arguments); | ||
return memo; | ||
}; | ||
}, | ||
isOldIE = memoize(function() { | ||
return /msie [6-9]\b/.test(window.navigator.userAgent.toLowerCase()); | ||
}), | ||
getHeadElement = memoize(function () { | ||
return document.head || document.getElementsByTagName("head")[0]; | ||
}), | ||
singletonElement = null, | ||
singletonCounter = 0; | ||
module.exports = function(list, options) { | ||
if(false) { | ||
if(typeof document !== "object") throw new Error("The style-loader cannot be used in a non-browser environment"); | ||
} | ||
options = options || {}; | ||
// Force single-tag solution on IE6-9, which has a hard limit on the # of <style> | ||
// tags it will allow on a page | ||
if (typeof options.singleton === "undefined") options.singleton = isOldIE(); | ||
var styles = listToStyles(list); | ||
addStylesToDom(styles, options); | ||
return function update(newList) { | ||
var mayRemove = []; | ||
for(var i = 0; i < styles.length; i++) { | ||
var item = styles[i]; | ||
var domStyle = stylesInDom[item.id]; | ||
domStyle.refs--; | ||
mayRemove.push(domStyle); | ||
} | ||
if(newList) { | ||
var newStyles = listToStyles(newList); | ||
addStylesToDom(newStyles, options); | ||
} | ||
for(var i = 0; i < mayRemove.length; i++) { | ||
var domStyle = mayRemove[i]; | ||
if(domStyle.refs === 0) { | ||
for(var j = 0; j < domStyle.parts.length; j++) | ||
domStyle.parts[j](); | ||
delete stylesInDom[domStyle.id]; | ||
} | ||
} | ||
}; | ||
} | ||
function addStylesToDom(styles, options) { | ||
for(var i = 0; i < styles.length; i++) { | ||
var item = styles[i]; | ||
var domStyle = stylesInDom[item.id]; | ||
if(domStyle) { | ||
domStyle.refs++; | ||
for(var j = 0; j < domStyle.parts.length; j++) { | ||
domStyle.parts[j](item.parts[j]); | ||
} | ||
for(; j < item.parts.length; j++) { | ||
domStyle.parts.push(addStyle(item.parts[j], options)); | ||
} | ||
} else { | ||
var parts = []; | ||
for(var j = 0; j < item.parts.length; j++) { | ||
parts.push(addStyle(item.parts[j], options)); | ||
} | ||
stylesInDom[item.id] = {id: item.id, refs: 1, parts: parts}; | ||
} | ||
} | ||
} | ||
function listToStyles(list) { | ||
var styles = []; | ||
var newStyles = {}; | ||
for(var i = 0; i < list.length; i++) { | ||
var item = list[i]; | ||
var id = item[0]; | ||
var css = item[1]; | ||
var media = item[2]; | ||
var sourceMap = item[3]; | ||
var part = {css: css, media: media, sourceMap: sourceMap}; | ||
if(!newStyles[id]) | ||
styles.push(newStyles[id] = {id: id, parts: [part]}); | ||
else | ||
newStyles[id].parts.push(part); | ||
} | ||
return styles; | ||
} | ||
function createStyleElement() { | ||
var styleElement = document.createElement("style"); | ||
var head = getHeadElement(); | ||
styleElement.type = "text/css"; | ||
head.appendChild(styleElement); | ||
return styleElement; | ||
} | ||
function createLinkElement() { | ||
var linkElement = document.createElement("link"); | ||
var head = getHeadElement(); | ||
linkElement.rel = "stylesheet"; | ||
head.appendChild(linkElement); | ||
return linkElement; | ||
} | ||
function addStyle(obj, options) { | ||
var styleElement, update, remove; | ||
if (options.singleton) { | ||
var styleIndex = singletonCounter++; | ||
styleElement = singletonElement || (singletonElement = createStyleElement()); | ||
update = applyToSingletonTag.bind(null, styleElement, styleIndex, false); | ||
remove = applyToSingletonTag.bind(null, styleElement, styleIndex, true); | ||
} else if(obj.sourceMap && | ||
typeof URL === "function" && | ||
typeof URL.createObjectURL === "function" && | ||
typeof URL.revokeObjectURL === "function" && | ||
typeof Blob === "function" && | ||
typeof btoa === "function") { | ||
styleElement = createLinkElement(); | ||
update = updateLink.bind(null, styleElement); | ||
remove = function() { | ||
styleElement.parentNode.removeChild(styleElement); | ||
if(styleElement.href) | ||
URL.revokeObjectURL(styleElement.href); | ||
}; | ||
} else { | ||
styleElement = createStyleElement(); | ||
update = applyToTag.bind(null, styleElement); | ||
remove = function() { | ||
styleElement.parentNode.removeChild(styleElement); | ||
}; | ||
} | ||
update(obj); | ||
return function updateStyle(newObj) { | ||
if(newObj) { | ||
if(newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap) | ||
return; | ||
update(obj = newObj); | ||
} else { | ||
remove(); | ||
} | ||
}; | ||
} | ||
var replaceText = (function () { | ||
var textStore = []; | ||
return function (index, replacement) { | ||
textStore[index] = replacement; | ||
return textStore.filter(Boolean).join('\n'); | ||
}; | ||
})(); | ||
function applyToSingletonTag(styleElement, index, remove, obj) { | ||
var css = remove ? "" : obj.css; | ||
if (styleElement.styleSheet) { | ||
styleElement.styleSheet.cssText = replaceText(index, css); | ||
} else { | ||
var cssNode = document.createTextNode(css); | ||
var childNodes = styleElement.childNodes; | ||
if (childNodes[index]) styleElement.removeChild(childNodes[index]); | ||
if (childNodes.length) { | ||
styleElement.insertBefore(cssNode, childNodes[index]); | ||
} else { | ||
styleElement.appendChild(cssNode); | ||
} | ||
} | ||
} | ||
function applyToTag(styleElement, obj) { | ||
var css = obj.css; | ||
var media = obj.media; | ||
var sourceMap = obj.sourceMap; | ||
if(media) { | ||
styleElement.setAttribute("media", media) | ||
} | ||
if(styleElement.styleSheet) { | ||
styleElement.styleSheet.cssText = css; | ||
} else { | ||
while(styleElement.firstChild) { | ||
styleElement.removeChild(styleElement.firstChild); | ||
} | ||
styleElement.appendChild(document.createTextNode(css)); | ||
} | ||
} | ||
function updateLink(linkElement, obj) { | ||
var css = obj.css; | ||
var media = obj.media; | ||
var sourceMap = obj.sourceMap; | ||
if(sourceMap) { | ||
css += "\n/*# sourceMappingURL=data:application/json;base64," + btoa(JSON.stringify(sourceMap)) + " */"; | ||
} | ||
var blob = new Blob([css], { type: "text/css" }); | ||
var oldSrc = linkElement.href; | ||
linkElement.href = URL.createObjectURL(blob); | ||
if(oldSrc) | ||
URL.revokeObjectURL(oldSrc); | ||
} | ||
/***/ }, | ||
/* 40 */ | ||
/***/ function(module, exports) { | ||
module.exports = __WEBPACK_EXTERNAL_MODULE_40__; | ||
/***/ }, | ||
/* 41 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
'use strict'; | ||
var _get = __webpack_require__(1)['default']; | ||
var _inherits = __webpack_require__(17)['default']; | ||
var _createClass = __webpack_require__(26)['default']; | ||
var _classCallCheck = __webpack_require__(29)['default']; | ||
var _Object$assign = __webpack_require__(30)['default']; | ||
var _interopRequireDefault = __webpack_require__(35)['default']; | ||
Object.defineProperty(exports, '__esModule', { | ||
value: true | ||
}); | ||
var _react = __webpack_require__(40); | ||
var _react2 = _interopRequireDefault(_react); | ||
var _classnames = __webpack_require__(42); | ||
var _classnames2 = _interopRequireDefault(_classnames); | ||
var ScrollBar = (function (_React$Component) { | ||
_inherits(ScrollBar, _React$Component); | ||
function ScrollBar(props) { | ||
_classCallCheck(this, ScrollBar); | ||
_get(Object.getPrototypeOf(ScrollBar.prototype), 'constructor', this).call(this, props); | ||
var newState = this.calculateState(props); | ||
this.state = { | ||
position: newState.position, | ||
scrollSize: newState.scrollSize, | ||
isDragging: false, | ||
lastClientPosition: 0 | ||
}; | ||
if (props.type === 'vertical') { | ||
this.bindedHandleMouseMove = this.handleMouseMoveForVertical.bind(this); | ||
} else { | ||
this.bindedHandleMouseMove = this.handleMouseMoveForHorizontal.bind(this); | ||
} | ||
this.bindedHandleMouseUp = this.handleMouseUp.bind(this); | ||
} | ||
_createClass(ScrollBar, [{ | ||
key: 'componentDidMount', | ||
value: function componentDidMount() { | ||
this.props.ownerDocument.addEventListener("mousemove", this.bindedHandleMouseMove); | ||
this.props.ownerDocument.addEventListener("mouseup", this.bindedHandleMouseUp); | ||
} | ||
}, { | ||
key: 'componentWillReceiveProps', | ||
value: function componentWillReceiveProps(nextProps) { | ||
this.setState(this.calculateState(nextProps)); | ||
} | ||
}, { | ||
key: 'componentWillUnmount', | ||
value: function componentWillUnmount() { | ||
this.props.ownerDocument.removeEventListener("mousemove", this.bindedHandleMouseMove); | ||
this.props.ownerDocument.removeEventListener("mouseup", this.bindedHandleMouseUp); | ||
} | ||
}, { | ||
key: 'calculateState', | ||
value: function calculateState(props) { | ||
var scrollSize = props.containerSize * props.containerSize / props.realSize; | ||
var multiplier = props.containerSize / props.realSize; | ||
var position = props.position * multiplier; | ||
return { | ||
scrollSize: scrollSize, | ||
position: position | ||
}; | ||
} | ||
}, { | ||
key: 'render', | ||
value: function render() { | ||
var scrollStyle = this.createScrollStyles(); | ||
var scrollbarClasses = (0, _classnames2['default'])(['scrollbar-container', { | ||
'active': this.state.isDragging, | ||
'horizontal': this.props.type === 'horizontal', | ||
'vertical': this.props.type === 'vertical' | ||
}]); | ||
return _react2['default'].createElement( | ||
'div', | ||
{ className: scrollbarClasses, style: this.props.containerStyle }, | ||
_react2['default'].createElement('div', { className: 'scrollbar', | ||
style: _Object$assign({}, this.props.scrollbarStyle, scrollStyle), | ||
onMouseDown: this.handleMouseDown.bind(this) | ||
}) | ||
); | ||
} | ||
}, { | ||
key: 'handleMouseMoveForHorizontal', | ||
value: function handleMouseMoveForHorizontal(e) { | ||
var multiplier = this.props.containerSize / this.props.realSize; | ||
if (this.state.isDragging) { | ||
e.preventDefault(); | ||
var deltaX = this.state.lastClientPosition - e.clientX; | ||
this.setState({ lastClientPosition: e.clientX }); | ||
this.props.onMove(0, deltaX / multiplier); | ||
} | ||
} | ||
}, { | ||
key: 'handleMouseMoveForVertical', | ||
value: function handleMouseMoveForVertical(e) { | ||
var multiplier = this.props.containerSize / this.props.realSize; | ||
if (this.state.isDragging) { | ||
e.preventDefault(); | ||
var deltaY = this.state.lastClientPosition - e.clientY; | ||
this.setState({ lastClientPosition: e.clientY }); | ||
this.props.onMove(deltaY / multiplier, 0); | ||
} | ||
} | ||
}, { | ||
key: 'handleMouseDown', | ||
value: function handleMouseDown(e) { | ||
var lastClientPosition = this.props.type === 'vertical' ? e.clientY : e.clientX; | ||
this.setState({ isDragging: true, lastClientPosition: lastClientPosition }); | ||
} | ||
}, { | ||
key: 'handleMouseUp', | ||
value: function handleMouseUp(e) { | ||
this.setState({ isDragging: false }); | ||
} | ||
}, { | ||
key: 'createScrollStyles', | ||
value: function createScrollStyles() { | ||
if (this.props.type === 'vertical') { | ||
return { | ||
height: this.state.scrollSize, | ||
marginTop: this.state.position | ||
}; | ||
} else { | ||
return { | ||
width: this.state.scrollSize, | ||
marginLeft: this.state.position | ||
}; | ||
} | ||
} | ||
}]); | ||
return ScrollBar; | ||
})(_react2['default'].Component); | ||
ScrollBar.propTypes = { | ||
onMove: _react2['default'].PropTypes.func, | ||
realSize: _react2['default'].PropTypes.number, | ||
containerSize: _react2['default'].PropTypes.number, | ||
position: _react2['default'].PropTypes.number, | ||
containerStyle: _react2['default'].PropTypes.object, | ||
scrollbarStyle: _react2['default'].PropTypes.object, | ||
type: _react2['default'].PropTypes.oneOf(['vertical', 'horizontal']), | ||
ownerDocument: _react2['default'].PropTypes.any | ||
}; | ||
ScrollBar.defaultProps = { | ||
type: 'vertical', | ||
ownerDocument: document | ||
}; | ||
exports['default'] = ScrollBar; | ||
module.exports = exports['default']; | ||
/***/ }, | ||
/* 42 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! | ||
Copyright (c) 2015 Jed Watson. | ||
@@ -6,2 +1479,235 @@ Licensed under the MIT License (MIT), see | ||
*/ | ||
function o(){for(var t,e="",n=0;n<arguments.length;n++)if(t=arguments[n])if("string"==typeof t||"number"==typeof t)e+=" "+t;else if("[object Array]"===Object.prototype.toString.call(t))e+=" "+o.apply(null,t);else if("object"==typeof t)for(var i in t)t.hasOwnProperty(i)&&t[i]&&(e+=" "+i);return e.substr(1)}var i,r;"undefined"!=typeof t&&t.exports&&(t.exports=o),i=[],r=function(){return o}.apply(e,i),!(void 0!==r&&(t.exports=r))},function(t,e){var n=function(t,e,n){return n=window.getComputedStyle,(n?n(t):t.currentStyle)[e.replace(/-(\w)/gi,function(t,e){return e.toUpperCase()})]};t.exports=n},function(t,e,n){n(38),t.exports=n(2).Object.assign},function(t,e,n){var o=n(1);t.exports=function(t,e){return o.create(t,e)}},function(t,e,n){var o=n(1);t.exports=function(t,e,n){return o.setDesc(t,e,n)}},function(t,e,n){var o=n(1);n(39),t.exports=function(t,e){return o.getDesc(t,e)}},function(t,e,n){n(40),t.exports=n(2).Object.setPrototypeOf},function(t,e){t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},function(t,e,n){var o=n(15);t.exports=function(t){if(!o(t))throw TypeError(t+" is not an object!");return t}},function(t,e){var n={}.toString;t.exports=function(t){return n.call(t).slice(8,-1)}},function(t,e){var n=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},function(t,e,n){var o=n(1),i=n(37),r=n(14);t.exports=n(13)(function(){var t=Object.assign,e={},n={},o=Symbol(),i="abcdefghijklmnopqrst";return e[o]=7,i.split("").forEach(function(t){n[t]=t}),7!=t({},e)[o]||Object.keys(t({},n)).join("")!=i})?function(t,e){for(var n=i(t),s=arguments,a=s.length,l=1,c=o.getKeys,u=o.getSymbols,f=o.isEnum;a>l;)for(var p,h=r(s[l++]),d=u?c(h).concat(u(h)):c(h),v=d.length,y=0;v>y;)f.call(h,p=d[y++])&&(n[p]=h[p]);return n}:Object.assign},function(t,e,n){var o=n(4),i=n(2),r=n(13);t.exports=function(t,e){var n=(i.Object||{})[t]||Object[t],s={};s[t]=e(n),o(o.S+o.F*r(function(){n(1)}),"Object",s)}},function(t,e,n){var o=n(1).getDesc,i=n(15),r=n(30),s=function(t,e){if(r(t),!i(e)&&null!==e)throw TypeError(e+": can't set as prototype!")};t.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(t,e,i){try{i=n(11)(Function.call,o(Object.prototype,"__proto__").set,2),i(t,[]),e=!(t instanceof Array)}catch(r){e=!0}return function(t,n){return s(t,n),e?t.__proto__=n:i(t,n),t}}({},!1):void 0),check:s}},function(t,e,n){var o=n(14),i=n(12);t.exports=function(t){return o(i(t))}},function(t,e,n){var o=n(12);t.exports=function(t){return Object(o(t))}},function(t,e,n){var o=n(4);o(o.S+o.F,"Object",{assign:n(33)})},function(t,e,n){var o=n(36);n(34)("getOwnPropertyDescriptor",function(t){return function(e,n){return t(o(e),n)}})},function(t,e,n){var o=n(4);o(o.S,"Object",{setPrototypeOf:n(35).set})},function(t,e,n){e=t.exports=n(42)(),e.push([t.id,".scrollarea,.scrollarea-content{position:relative;overflow:hidden}.scrollarea-content{margin:0;padding:0}.scrollarea .scrollbar-container{position:absolute;background:0 0;opacity:.1;z-index:9999;-webkit-transition:all .4s;-moz-transition:all .4s;-ms-transition:all .4s;-o-transition:all .4s;transition:all .4s}.scrollarea .scrollbar-container.horizontal{width:100%;height:10px;left:0;bottom:0}.scrollarea .scrollbar-container.horizontal .scrollbar{width:20px;height:8px;background:#000;margin-top:1px}.scrollarea .scrollbar-container.vertical{width:10px;height:100%;right:0;top:0}.scrollarea .scrollbar-container.vertical .scrollbar{width:8px;height:20px;background:#000;margin-left:1px}.scrollarea .scrollbar-container.active,.scrollarea .scrollbar-container:hover{background:gray;opacity:.6!important}.scrollarea:hover .scrollbar-container{opacity:.3}",""])},function(t,e){t.exports=function(){var t=[];return t.toString=function(){for(var t=[],e=0;e<this.length;e++){var n=this[e];n[2]?t.push("@media "+n[2]+"{"+n[1]+"}"):t.push(n[1])}return t.join("")},t.i=function(e,n){"string"==typeof e&&(e=[[null,e,""]]);for(var o={},i=0;i<this.length;i++){var r=this[i][0];"number"==typeof r&&(o[r]=!0)}for(var i=0;i<e.length;i++){var s=e[i];"number"==typeof s[0]&&o[s[0]]||(n&&!s[2]?s[2]=n:n&&(s[2]="("+s[2]+") and ("+n+")"),t.push(s))}},t}},function(t,e,n){function o(t){var e=i(t,"line-height"),n=parseFloat(e,10);if(e===n+""){var o=t.style.lineHeight;t.style.lineHeight=e+"em",e=i(t,"line-height"),n=parseFloat(e,10),o?t.style.lineHeight=o:delete t.style.lineHeight}if(-1!==e.indexOf("pt")?(n*=4,n/=3):-1!==e.indexOf("mm")?(n*=96,n/=25.4):-1!==e.indexOf("cm")?(n*=96,n/=2.54):-1!==e.indexOf("in")?n*=96:-1!==e.indexOf("pc")&&(n*=16),n=Math.round(n),"normal"===e){var r=t.nodeName,s=document.createElement(r);s.innerHTML=" ";var a=i(t,"font-size");s.style.fontSize=a;var l=document.body;l.appendChild(s);var c=s.offsetHeight;n=c,l.removeChild(s)}return n}var i=n(23);t.exports=o},function(t,e,n){function o(t,e){for(var n=0;n<t.length;n++){var o=t[n],i=f[o.id];if(i){i.refs++;for(var r=0;r<i.parts.length;r++)i.parts[r](o.parts[r]);for(;r<o.parts.length;r++)i.parts.push(a(o.parts[r],e))}else{for(var s=[],r=0;r<o.parts.length;r++)s.push(a(o.parts[r],e));f[o.id]={id:o.id,refs:1,parts:s}}}}function i(t){for(var e=[],n={},o=0;o<t.length;o++){var i=t[o],r=i[0],s=i[1],a=i[2],l=i[3],c={css:s,media:a,sourceMap:l};n[r]?n[r].parts.push(c):e.push(n[r]={id:r,parts:[c]})}return e}function r(){var t=document.createElement("style"),e=d();return t.type="text/css",e.appendChild(t),t}function s(){var t=document.createElement("link"),e=d();return t.rel="stylesheet",e.appendChild(t),t}function a(t,e){var n,o,i;if(e.singleton){var a=y++;n=v||(v=r()),o=l.bind(null,n,a,!1),i=l.bind(null,n,a,!0)}else t.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=s(),o=u.bind(null,n),i=function(){n.parentNode.removeChild(n),n.href&&URL.revokeObjectURL(n.href)}):(n=r(),o=c.bind(null,n),i=function(){n.parentNode.removeChild(n)});return o(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap)return;o(t=e)}else i()}}function l(t,e,n,o){var i=n?"":o.css;if(t.styleSheet)t.styleSheet.cssText=g(e,i);else{var r=document.createTextNode(i),s=t.childNodes;s[e]&&t.removeChild(s[e]),s.length?t.insertBefore(r,s[e]):t.appendChild(r)}}function c(t,e){var n=e.css,o=e.media;e.sourceMap;if(o&&t.setAttribute("media",o),t.styleSheet)t.styleSheet.cssText=n;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(n))}}function u(t,e){var n=e.css,o=(e.media,e.sourceMap);o&&(n+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(JSON.stringify(o))+" */");var i=new Blob([n],{type:"text/css"}),r=t.href;t.href=URL.createObjectURL(i),r&&URL.revokeObjectURL(r)}var f={},p=function(t){var e;return function(){return"undefined"==typeof e&&(e=t.apply(this,arguments)),e}},h=p(function(){return/msie [6-9]\b/.test(window.navigator.userAgent.toLowerCase())}),d=p(function(){return document.head||document.getElementsByTagName("head")[0]}),v=null,y=0;t.exports=function(t,e){e=e||{},"undefined"==typeof e.singleton&&(e.singleton=h());var n=i(t);return o(n,e),function(t){for(var r=[],s=0;s<n.length;s++){var a=n[s],l=f[a.id];l.refs--,r.push(l)}if(t){var c=i(t);o(c,e)}for(var s=0;s<r.length;s++){var l=r[s];if(0===l.refs){for(var u=0;u<l.parts.length;u++)l.parts[u]();delete f[l.id]}}}};var g=function(){var t=[];return function(e,n){return t[e]=n,t.filter(Boolean).join("\n")}}()},function(t,e,n){var o=n(41);"string"==typeof o&&(o=[[t.id,o,""]]);n(44)(o,{})}])}); | ||
function classNames() { | ||
var classes = ''; | ||
var arg; | ||
for (var i = 0; i < arguments.length; i++) { | ||
arg = arguments[i]; | ||
if (!arg) { | ||
continue; | ||
} | ||
if ('string' === typeof arg || 'number' === typeof arg) { | ||
classes += ' ' + arg; | ||
} else if (Object.prototype.toString.call(arg) === '[object Array]') { | ||
classes += ' ' + classNames.apply(null, arg); | ||
} else if ('object' === typeof arg) { | ||
for (var key in arg) { | ||
if (!arg.hasOwnProperty(key) || !arg[key]) { | ||
continue; | ||
} | ||
classes += ' ' + key; | ||
} | ||
} | ||
} | ||
return classes.substr(1); | ||
} | ||
// safely export classNames for node / browserify | ||
if (typeof module !== 'undefined' && module.exports) { | ||
module.exports = classNames; | ||
} | ||
// safely export classNames for RequireJS | ||
if (true) { | ||
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function() { | ||
return classNames; | ||
}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); | ||
} | ||
/***/ }, | ||
/* 43 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
'use strict'; | ||
var _interopRequireDefault = __webpack_require__(35)['default']; | ||
Object.defineProperty(exports, '__esModule', { | ||
value: true | ||
}); | ||
exports.findDOMNode = findDOMNode; | ||
exports.warnAboutFunctionChild = warnAboutFunctionChild; | ||
exports.warnAboutElementChild = warnAboutElementChild; | ||
exports.positiveOrZero = positiveOrZero; | ||
var _react = __webpack_require__(40); | ||
var _react2 = _interopRequireDefault(_react); | ||
var react13 = isReact13(_react2['default']); | ||
var didWarnAboutChild = false; | ||
function findDOMNode(component) { | ||
if (!react13) { | ||
return component; | ||
} else { | ||
return _react2['default'].findDOMNode(component); | ||
} | ||
} | ||
function warnAboutFunctionChild() { | ||
if (didWarnAboutChild || react13) { | ||
return; | ||
} | ||
didWarnAboutChild = true; | ||
console.error('With React 0.14 and later versions, you no longer need to wrap <ScrollArea> child into a function.'); | ||
} | ||
function warnAboutElementChild() { | ||
if (didWarnAboutChild || !react13) { | ||
return; | ||
} | ||
didWarnAboutChild = true; | ||
console.error('With React 0.13, you need to wrap <ScrollArea> child into a function.'); | ||
} | ||
function positiveOrZero(number) { | ||
return number < 0 ? 0 : number; | ||
} | ||
function isReact13(React) { | ||
var version = React.version; | ||
if (typeof version !== 'string') { | ||
return true; | ||
} | ||
var parts = version.split('.'); | ||
var major = parseInt(parts[0], 10); | ||
var minor = parseInt(parts[1], 10); | ||
return major === 0 && minor === 13; | ||
} | ||
/***/ }, | ||
/* 44 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
// Load in dependencies | ||
var computedStyle = __webpack_require__(45); | ||
/** | ||
* Calculate the `line-height` of a given node | ||
* @param {HTMLElement} node Element to calculate line height of. Must be in the DOM. | ||
* @returns {Number} `line-height` of the element in pixels | ||
*/ | ||
function lineHeight(node) { | ||
// Grab the line-height via style | ||
var lnHeightStr = computedStyle(node, 'line-height'), | ||
lnHeight = parseFloat(lnHeightStr, 10); | ||
// If the lineHeight did not contain a unit (i.e. it was numeric), convert it to ems (e.g. '2.3' === '2.3em') | ||
if (lnHeightStr === lnHeight + '') { | ||
// Save the old lineHeight style and update the em unit to the element | ||
var _lnHeightStyle = node.style.lineHeight; | ||
node.style.lineHeight = lnHeightStr + 'em'; | ||
// Calculate the em based height | ||
lnHeightStr = computedStyle(node, 'line-height'); | ||
lnHeight = parseFloat(lnHeightStr, 10); | ||
// Revert the lineHeight style | ||
if (_lnHeightStyle) { | ||
node.style.lineHeight = _lnHeightStyle; | ||
} else { | ||
delete node.style.lineHeight; | ||
} | ||
} | ||
// If the lineHeight is in `pt`, convert it to pixels (4px for 3pt) | ||
// DEV: `em` units are converted to `pt` in IE6 | ||
// Conversion ratio from https://developer.mozilla.org/en-US/docs/Web/CSS/length | ||
if (lnHeightStr.indexOf('pt') !== -1) { | ||
lnHeight *= 4; | ||
lnHeight /= 3; | ||
} else if (lnHeightStr.indexOf('mm') !== -1) { | ||
// Otherwise, if the lineHeight is in `mm`, convert it to pixels (96px for 25.4mm) | ||
lnHeight *= 96; | ||
lnHeight /= 25.4; | ||
} else if (lnHeightStr.indexOf('cm') !== -1) { | ||
// Otherwise, if the lineHeight is in `cm`, convert it to pixels (96px for 2.54cm) | ||
lnHeight *= 96; | ||
lnHeight /= 2.54; | ||
} else if (lnHeightStr.indexOf('in') !== -1) { | ||
// Otherwise, if the lineHeight is in `in`, convert it to pixels (96px for 1in) | ||
lnHeight *= 96; | ||
} else if (lnHeightStr.indexOf('pc') !== -1) { | ||
// Otherwise, if the lineHeight is in `pc`, convert it to pixels (12pt for 1pc) | ||
lnHeight *= 16; | ||
} | ||
// Continue our computation | ||
lnHeight = Math.round(lnHeight); | ||
// If the line-height is "normal", calculate by font-size | ||
if (lnHeightStr === 'normal') { | ||
// Create a temporary node | ||
var nodeName = node.nodeName, | ||
_node = document.createElement(nodeName); | ||
_node.innerHTML = ' '; | ||
// Set the font-size of the element | ||
var fontSizeStr = computedStyle(node, 'font-size'); | ||
_node.style.fontSize = fontSizeStr; | ||
// Append it to the body | ||
var body = document.body; | ||
body.appendChild(_node); | ||
// Assume the line height of the element is the height | ||
var height = _node.offsetHeight; | ||
lnHeight = height; | ||
// Remove our child from the DOM | ||
body.removeChild(_node); | ||
} | ||
// Return the calculated height | ||
return lnHeight; | ||
} | ||
// Export lineHeight | ||
module.exports = lineHeight; | ||
/***/ }, | ||
/* 45 */ | ||
/***/ function(module, exports) { | ||
// This code has been refactored for 140 bytes | ||
// You can see the original here: https://github.com/twolfson/computedStyle/blob/04cd1da2e30fa45844f95f5cb1ac898e9b9ef050/lib/computedStyle.js | ||
var computedStyle = function (el, prop, getComputedStyle) { | ||
getComputedStyle = window.getComputedStyle; | ||
// In one fell swoop | ||
return ( | ||
// If we have getComputedStyle | ||
getComputedStyle ? | ||
// Query it | ||
// TODO: From CSS-Query notes, we might need (node, null) for FF | ||
getComputedStyle(el) : | ||
// Otherwise, we are in IE and use currentStyle | ||
el.currentStyle | ||
)[ | ||
// Switch to camelCase for CSSOM | ||
// DEV: Grabbed from jQuery | ||
// https://github.com/jquery/jquery/blob/1.9-stable/src/css.js#L191-L194 | ||
// https://github.com/jquery/jquery/blob/1.9-stable/src/core.js#L593-L597 | ||
prop.replace(/-(\w)/gi, function (word, letter) { | ||
return letter.toUpperCase(); | ||
}) | ||
]; | ||
}; | ||
module.exports = computedStyle; | ||
/***/ } | ||
/******/ ]) | ||
}); | ||
; |
{ | ||
"name": "react-scrollbar-iframe", | ||
"version": "0.3.4", | ||
"version": "0.3.5", | ||
"description": "ScrollArea component for react", | ||
@@ -5,0 +5,0 @@ "main": "./dist/scrollArea.js", |
@@ -312,4 +312,4 @@ import '../less/scrollbar.less'; | ||
horizontalScrollbarStyle: React.PropTypes.object, | ||
contentWindow: React.PropTypes.node, | ||
ownerDocument: React.PropTypes.node | ||
contentWindow: React.PropTypes.any, | ||
ownerDocument: React.PropTypes.any | ||
}; | ||
@@ -316,0 +316,0 @@ |
@@ -122,3 +122,3 @@ import React from 'react'; | ||
type: React.PropTypes.oneOf(['vertical', 'horizontal']), | ||
ownerDocument: React.PropTypes.node | ||
ownerDocument: React.PropTypes.any | ||
}; | ||
@@ -125,0 +125,0 @@ |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses eval() which is a dangerous function. This prevents the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses eval() which is a dangerous function. This prevents the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
120974
2218
2
1
2