You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

1 line
4.0 KiB

  1. !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("prop-types"),require("smooth-scrollbar")):"function"==typeof define&&define.amd?define(["react","prop-types","smooth-scrollbar"],t):"object"==typeof exports?exports.Scrollbar=t(require("react"),require("prop-types"),require("smooth-scrollbar")):e.Scrollbar=t(e.React,e.PropTypes,e.Scrollbar)}(this,function(e,t,r){return function(e){function t(o){if(r[o])return r[o].exports;var n=r[o]={exports:{},id:o,loaded:!1};return e[o].call(n.exports,n,n.exports,t),n.loaded=!0,n.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function n(e,t){var r={};for(var o in e)t.indexOf(o)>=0||Object.prototype.hasOwnProperty.call(e,o)&&(r[o]=e[o]);return r}function l(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function c(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},u=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}(),s=r(1),f=o(s),p=r(2),b=o(p),d=r(3),h=o(d),y=function(e){function t(e){l(this,t);var r=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return r.callbacks=[],r}return c(t,e),u(t,[{key:"getChildContext",value:function(){var e=this;return{getScrollbar:function(t){"function"==typeof t&&(e.scrollbar?setTimeout(function(){return t(e.scrollbar)}):e.callbacks.push(t))}}}},{key:"componentDidMount",value:function(){var e=this;this.scrollbar=h["default"].init(this.$container,this.props),this.callbacks.forEach(function(t){requestAnimationFrame(function(){return t(e.scrollbar)})}),this.scrollbar.addListener(this.handleScroll.bind(this))}},{key:"componentWillUnmount",value:function(){this.scrollbar&&this.scrollbar.destroy()}},{key:"componentWillReceiveProps",value:function(e){var t=this;Object.keys(e).forEach(function(r){!r in t.scrollbar.options||("plugins"===r?Object.keys(e.plugins).forEach(function(r){t.scrollbar.updatePluginOptions(r,e.plugins[r])}):t.scrollbar.options[r]=e[r])})}},{key:"componentDidUpdate",value:function(){this.scrollbar&&this.scrollbar.update()}},{key:"handleScroll",value:function(e){this.props.onScroll&&this.props.onScroll(e,this.scrollbar)}},{key:"render",value:function(){var e=this,t=this.props,r=(t.damping,t.thumbMinSize,t.syncCallbacks,t.renderByPixels,t.alwaysShowTracks,t.continuousScrolling,t.wheelEventTarget,t.plugins,t.onScroll,t.children),o=n(t,["damping","thumbMinSize","syncCallbacks","renderByPixels","alwaysShowTracks","continuousScrolling","wheelEventTarget","plugins","onScroll","children"]);return f["default"].createElement("section",a({"data-scrollbar":!0,ref:function(t){return e.$container=t}},o),f["default"].createElement("div",null,r))}}]),t}(f["default"].Component);y.propTypes={damping:b["default"].number,thumbMinSize:b["default"].number,syncCallbacks:b["default"].bool,renderByPixels:b["default"].bool,alwaysShowTracks:b["default"].bool,continuousScrolling:b["default"].bool,wheelEventTarget:b["default"].element,plugins:b["default"].object,onScroll:b["default"].func,children:b["default"].node},y.childContextTypes={getScrollbar:b["default"].func},t["default"]=y,e.exports=t["default"]},function(t,r){t.exports=e},function(e,r){e.exports=t},function(e,t){e.exports=r}])});