@mjhls/mjh-framework 1.0.338 → 1.0.339

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,11 +1,6 @@
1
1
  'use strict';
2
2
 
3
- function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
4
-
5
3
  var _commonjsHelpers = require('./_commonjsHelpers-06173234.js');
6
- var React = require('react');
7
- var React__default = _interopDefault(React);
8
- var reactDom = _interopDefault(require('react-dom'));
9
4
 
10
5
  var moment = _commonjsHelpers.createCommonjsModule(function (module, exports) {
11
6
  (function (global, factory) {
@@ -5669,1011 +5664,4 @@ var moment = _commonjsHelpers.createCommonjsModule(function (module, exports) {
5669
5664
  })));
5670
5665
  });
5671
5666
 
5672
- /*! *****************************************************************************
5673
- Copyright (c) Microsoft Corporation. All rights reserved.
5674
- Licensed under the Apache License, Version 2.0 (the "License"); you may not use
5675
- this file except in compliance with the License. You may obtain a copy of the
5676
- License at http://www.apache.org/licenses/LICENSE-2.0
5677
-
5678
- THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
5679
- KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
5680
- WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
5681
- MERCHANTABLITY OR NON-INFRINGEMENT.
5682
-
5683
- See the Apache Version 2.0 License for specific language governing permissions
5684
- and limitations under the License.
5685
- ***************************************************************************** */
5686
- /* global Reflect, Promise */
5687
-
5688
- var extendStatics = function(d, b) {
5689
- extendStatics = Object.setPrototypeOf ||
5690
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5691
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
5692
- return extendStatics(d, b);
5693
- };
5694
-
5695
- function __extends(d, b) {
5696
- extendStatics(d, b);
5697
- function __() { this.constructor = d; }
5698
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
5699
- }
5700
-
5701
- var __assign = function() {
5702
- __assign = Object.assign || function __assign(t) {
5703
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5704
- s = arguments[i];
5705
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
5706
- }
5707
- return t;
5708
- };
5709
- return __assign.apply(this, arguments);
5710
- };
5711
-
5712
- /* eslint-disable no-undefined,no-param-reassign,no-shadow */
5713
-
5714
- /**
5715
- * Throttle execution of a function. Especially useful for rate limiting
5716
- * execution of handlers on events like resize and scroll.
5717
- *
5718
- * @param {Number} delay A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful.
5719
- * @param {Boolean} [noTrailing] Optional, defaults to false. If noTrailing is true, callback will only execute every `delay` milliseconds while the
5720
- * throttled-function is being called. If noTrailing is false or unspecified, callback will be executed one final time
5721
- * after the last throttled-function call. (After the throttled-function has not been called for `delay` milliseconds,
5722
- * the internal counter is reset)
5723
- * @param {Function} callback A function to be executed after delay milliseconds. The `this` context and all arguments are passed through, as-is,
5724
- * to `callback` when the throttled-function is executed.
5725
- * @param {Boolean} [debounceMode] If `debounceMode` is true (at begin), schedule `clear` to execute after `delay` ms. If `debounceMode` is false (at end),
5726
- * schedule `callback` to execute after `delay` ms.
5727
- *
5728
- * @return {Function} A new, throttled, function.
5729
- */
5730
- function throttle (delay, noTrailing, callback, debounceMode) {
5731
- /*
5732
- * After wrapper has stopped being called, this timeout ensures that
5733
- * `callback` is executed at the proper times in `throttle` and `end`
5734
- * debounce modes.
5735
- */
5736
- var timeoutID;
5737
- var cancelled = false; // Keep track of the last time `callback` was executed.
5738
-
5739
- var lastExec = 0; // Function to clear existing timeout
5740
-
5741
- function clearExistingTimeout() {
5742
- if (timeoutID) {
5743
- clearTimeout(timeoutID);
5744
- }
5745
- } // Function to cancel next exec
5746
-
5747
-
5748
- function cancel() {
5749
- clearExistingTimeout();
5750
- cancelled = true;
5751
- } // `noTrailing` defaults to falsy.
5752
-
5753
-
5754
- if (typeof noTrailing !== 'boolean') {
5755
- debounceMode = callback;
5756
- callback = noTrailing;
5757
- noTrailing = undefined;
5758
- }
5759
- /*
5760
- * The `wrapper` function encapsulates all of the throttling / debouncing
5761
- * functionality and when executed will limit the rate at which `callback`
5762
- * is executed.
5763
- */
5764
-
5765
-
5766
- function wrapper() {
5767
- var self = this;
5768
- var elapsed = Date.now() - lastExec;
5769
- var args = arguments;
5770
-
5771
- if (cancelled) {
5772
- return;
5773
- } // Execute `callback` and update the `lastExec` timestamp.
5774
-
5775
-
5776
- function exec() {
5777
- lastExec = Date.now();
5778
- callback.apply(self, args);
5779
- }
5780
- /*
5781
- * If `debounceMode` is true (at begin) this is used to clear the flag
5782
- * to allow future `callback` executions.
5783
- */
5784
-
5785
-
5786
- function clear() {
5787
- timeoutID = undefined;
5788
- }
5789
-
5790
- if (debounceMode && !timeoutID) {
5791
- /*
5792
- * Since `wrapper` is being called for the first time and
5793
- * `debounceMode` is true (at begin), execute `callback`.
5794
- */
5795
- exec();
5796
- }
5797
-
5798
- clearExistingTimeout();
5799
-
5800
- if (debounceMode === undefined && elapsed > delay) {
5801
- /*
5802
- * In throttle mode, if `delay` time has been exceeded, execute
5803
- * `callback`.
5804
- */
5805
- exec();
5806
- } else if (noTrailing !== true) {
5807
- /*
5808
- * In trailing throttle mode, since `delay` time has not been
5809
- * exceeded, schedule `callback` to execute `delay` ms after most
5810
- * recent execution.
5811
- *
5812
- * If `debounceMode` is true (at begin), schedule `clear` to execute
5813
- * after `delay` ms.
5814
- *
5815
- * If `debounceMode` is false (at end), schedule `callback` to
5816
- * execute after `delay` ms.
5817
- */
5818
- timeoutID = setTimeout(debounceMode ? clear : exec, debounceMode === undefined ? delay - elapsed : delay);
5819
- }
5820
- }
5821
-
5822
- wrapper.cancel = cancel; // Return the wrapper function.
5823
-
5824
- return wrapper;
5825
- }
5826
-
5827
- var ThresholdUnits = {
5828
- Pixel: 'Pixel',
5829
- Percent: 'Percent',
5830
- };
5831
- var defaultThreshold = {
5832
- unit: ThresholdUnits.Percent,
5833
- value: 0.8,
5834
- };
5835
- function parseThreshold(scrollThreshold) {
5836
- if (typeof scrollThreshold === 'number') {
5837
- return {
5838
- unit: ThresholdUnits.Percent,
5839
- value: scrollThreshold * 100,
5840
- };
5841
- }
5842
- if (typeof scrollThreshold === 'string') {
5843
- if (scrollThreshold.match(/^(\d*(\.\d+)?)px$/)) {
5844
- return {
5845
- unit: ThresholdUnits.Pixel,
5846
- value: parseFloat(scrollThreshold),
5847
- };
5848
- }
5849
- if (scrollThreshold.match(/^(\d*(\.\d+)?)%$/)) {
5850
- return {
5851
- unit: ThresholdUnits.Percent,
5852
- value: parseFloat(scrollThreshold),
5853
- };
5854
- }
5855
- console.warn('scrollThreshold format is invalid. Valid formats: "120px", "50%"...');
5856
- return defaultThreshold;
5857
- }
5858
- console.warn('scrollThreshold should be string or number');
5859
- return defaultThreshold;
5860
- }
5861
-
5862
- var InfiniteScroll = /** @class */ (function (_super) {
5863
- __extends(InfiniteScroll, _super);
5864
- function InfiniteScroll(props) {
5865
- var _this = _super.call(this, props) || this;
5866
- _this.lastScrollTop = 0;
5867
- _this.actionTriggered = false;
5868
- // variables to keep track of pull down behaviour
5869
- _this.startY = 0;
5870
- _this.currentY = 0;
5871
- _this.dragging = false;
5872
- // will be populated in componentDidMount
5873
- // based on the height of the pull down element
5874
- _this.maxPullDownDistance = 0;
5875
- _this.getScrollableTarget = function () {
5876
- if (_this.props.scrollableTarget instanceof HTMLElement)
5877
- return _this.props.scrollableTarget;
5878
- if (typeof _this.props.scrollableTarget === 'string') {
5879
- return document.getElementById(_this.props.scrollableTarget);
5880
- }
5881
- if (_this.props.scrollableTarget === null) {
5882
- console.warn("You are trying to pass scrollableTarget but it is null. This might\n happen because the element may not have been added to DOM yet.\n See https://github.com/ankeetmaini/react-infinite-scroll-component/issues/59 for more info.\n ");
5883
- }
5884
- return null;
5885
- };
5886
- _this.onStart = function (evt) {
5887
- if (_this.lastScrollTop)
5888
- return;
5889
- _this.dragging = true;
5890
- if (evt instanceof MouseEvent) {
5891
- _this.startY = evt.pageY;
5892
- }
5893
- else if (evt instanceof TouchEvent) {
5894
- _this.startY = evt.touches[0].pageY;
5895
- }
5896
- _this.currentY = _this.startY;
5897
- if (_this._infScroll) {
5898
- _this._infScroll.style.willChange = 'transform';
5899
- _this._infScroll.style.transition = "transform 0.2s cubic-bezier(0,0,0.31,1)";
5900
- }
5901
- };
5902
- _this.onMove = function (evt) {
5903
- if (!_this.dragging)
5904
- return;
5905
- if (evt instanceof MouseEvent) {
5906
- _this.currentY = evt.pageY;
5907
- }
5908
- else if (evt instanceof TouchEvent) {
5909
- _this.currentY = evt.touches[0].pageY;
5910
- }
5911
- // user is scrolling down to up
5912
- if (_this.currentY < _this.startY)
5913
- return;
5914
- if (_this.currentY - _this.startY >=
5915
- Number(_this.props.pullDownToRefreshThreshold)) {
5916
- _this.setState({
5917
- pullToRefreshThresholdBreached: true,
5918
- });
5919
- }
5920
- // so you can drag upto 1.5 times of the maxPullDownDistance
5921
- if (_this.currentY - _this.startY > _this.maxPullDownDistance * 1.5)
5922
- return;
5923
- if (_this._infScroll) {
5924
- _this._infScroll.style.overflow = 'visible';
5925
- _this._infScroll.style.transform = "translate3d(0px, " + (_this.currentY -
5926
- _this.startY) + "px, 0px)";
5927
- }
5928
- };
5929
- _this.onEnd = function () {
5930
- _this.startY = 0;
5931
- _this.currentY = 0;
5932
- _this.dragging = false;
5933
- if (_this.state.pullToRefreshThresholdBreached) {
5934
- _this.props.refreshFunction && _this.props.refreshFunction();
5935
- _this.setState({
5936
- pullToRefreshThresholdBreached: false,
5937
- });
5938
- }
5939
- requestAnimationFrame(function () {
5940
- // this._infScroll
5941
- if (_this._infScroll) {
5942
- _this._infScroll.style.overflow = 'auto';
5943
- _this._infScroll.style.transform = 'none';
5944
- _this._infScroll.style.willChange = 'none';
5945
- }
5946
- });
5947
- };
5948
- _this.onScrollListener = function (event) {
5949
- if (typeof _this.props.onScroll === 'function') {
5950
- // Execute this callback in next tick so that it does not affect the
5951
- // functionality of the library.
5952
- setTimeout(function () { return _this.props.onScroll && _this.props.onScroll(event); }, 0);
5953
- }
5954
- var target = _this.props.height || _this._scrollableNode
5955
- ? event.target
5956
- : document.documentElement.scrollTop
5957
- ? document.documentElement
5958
- : document.body;
5959
- // return immediately if the action has already been triggered,
5960
- // prevents multiple triggers.
5961
- if (_this.actionTriggered)
5962
- return;
5963
- var atBottom = _this.isElementAtBottom(target, _this.props.scrollThreshold);
5964
- // call the `next` function in the props to trigger the next data fetch
5965
- if (atBottom && _this.props.hasMore) {
5966
- _this.actionTriggered = true;
5967
- _this.setState({ showLoader: true });
5968
- _this.props.next && _this.props.next();
5969
- }
5970
- _this.lastScrollTop = target.scrollTop;
5971
- };
5972
- _this.state = {
5973
- showLoader: false,
5974
- pullToRefreshThresholdBreached: false,
5975
- };
5976
- _this.throttledOnScrollListener = throttle(150, _this.onScrollListener).bind(_this);
5977
- _this.onStart = _this.onStart.bind(_this);
5978
- _this.onMove = _this.onMove.bind(_this);
5979
- _this.onEnd = _this.onEnd.bind(_this);
5980
- return _this;
5981
- }
5982
- InfiniteScroll.prototype.componentDidMount = function () {
5983
- if (typeof this.props.dataLength === 'undefined') {
5984
- throw new Error("mandatory prop \"dataLength\" is missing. The prop is needed" +
5985
- " when loading more content. Check README.md for usage");
5986
- }
5987
- this._scrollableNode = this.getScrollableTarget();
5988
- this.el = this.props.height
5989
- ? this._infScroll
5990
- : this._scrollableNode || window;
5991
- if (this.el) {
5992
- this.el.addEventListener('scroll', this
5993
- .throttledOnScrollListener);
5994
- }
5995
- if (typeof this.props.initialScrollY === 'number' &&
5996
- this.el &&
5997
- this.el instanceof HTMLElement &&
5998
- this.el.scrollHeight > this.props.initialScrollY) {
5999
- this.el.scrollTo(0, this.props.initialScrollY);
6000
- }
6001
- if (this.props.pullDownToRefresh && this.el) {
6002
- this.el.addEventListener('touchstart', this.onStart);
6003
- this.el.addEventListener('touchmove', this.onMove);
6004
- this.el.addEventListener('touchend', this.onEnd);
6005
- this.el.addEventListener('mousedown', this.onStart);
6006
- this.el.addEventListener('mousemove', this.onMove);
6007
- this.el.addEventListener('mouseup', this.onEnd);
6008
- // get BCR of pullDown element to position it above
6009
- this.maxPullDownDistance =
6010
- (this._pullDown &&
6011
- this._pullDown.firstChild &&
6012
- this._pullDown.firstChild.getBoundingClientRect()
6013
- .height) ||
6014
- 0;
6015
- this.forceUpdate();
6016
- if (typeof this.props.refreshFunction !== 'function') {
6017
- throw new Error("Mandatory prop \"refreshFunction\" missing.\n Pull Down To Refresh functionality will not work\n as expected. Check README.md for usage'");
6018
- }
6019
- }
6020
- };
6021
- InfiniteScroll.prototype.componentWillUnmount = function () {
6022
- if (this.el) {
6023
- this.el.removeEventListener('scroll', this
6024
- .throttledOnScrollListener);
6025
- if (this.props.pullDownToRefresh) {
6026
- this.el.removeEventListener('touchstart', this.onStart);
6027
- this.el.removeEventListener('touchmove', this.onMove);
6028
- this.el.removeEventListener('touchend', this.onEnd);
6029
- this.el.removeEventListener('mousedown', this.onStart);
6030
- this.el.removeEventListener('mousemove', this.onMove);
6031
- this.el.removeEventListener('mouseup', this.onEnd);
6032
- }
6033
- }
6034
- };
6035
- InfiniteScroll.prototype.UNSAFE_componentWillReceiveProps = function (props) {
6036
- // do nothing when dataLength and key are unchanged
6037
- if (this.props.key === props.key &&
6038
- this.props.dataLength === props.dataLength)
6039
- return;
6040
- this.actionTriggered = false;
6041
- // update state when new data was sent in
6042
- this.setState({
6043
- showLoader: false,
6044
- });
6045
- };
6046
- InfiniteScroll.prototype.isElementAtBottom = function (target, scrollThreshold) {
6047
- if (scrollThreshold === void 0) { scrollThreshold = 0.8; }
6048
- var clientHeight = target === document.body || target === document.documentElement
6049
- ? window.screen.availHeight
6050
- : target.clientHeight;
6051
- var threshold = parseThreshold(scrollThreshold);
6052
- if (threshold.unit === ThresholdUnits.Pixel) {
6053
- return (target.scrollTop + clientHeight >= target.scrollHeight - threshold.value);
6054
- }
6055
- return (target.scrollTop + clientHeight >=
6056
- (threshold.value / 100) * target.scrollHeight);
6057
- };
6058
- InfiniteScroll.prototype.render = function () {
6059
- var _this = this;
6060
- var style = __assign({ height: this.props.height || 'auto', overflow: 'auto', WebkitOverflowScrolling: 'touch' }, this.props.style);
6061
- var hasChildren = this.props.hasChildren ||
6062
- !!(this.props.children &&
6063
- this.props.children instanceof Array &&
6064
- this.props.children.length);
6065
- // because heighted infiniteScroll visualy breaks
6066
- // on drag down as overflow becomes visible
6067
- var outerDivStyle = this.props.pullDownToRefresh && this.props.height
6068
- ? { overflow: 'auto' }
6069
- : {};
6070
- return (React__default.createElement("div", { style: outerDivStyle, className: "infinite-scroll-component__outerdiv" },
6071
- React__default.createElement("div", { className: "infinite-scroll-component " + (this.props.className || ''), ref: function (infScroll) { return (_this._infScroll = infScroll); }, style: style },
6072
- this.props.pullDownToRefresh && (React__default.createElement("div", { style: { position: 'relative' }, ref: function (pullDown) { return (_this._pullDown = pullDown); } },
6073
- React__default.createElement("div", { style: {
6074
- position: 'absolute',
6075
- left: 0,
6076
- right: 0,
6077
- top: -1 * this.maxPullDownDistance,
6078
- } }, this.state.pullToRefreshThresholdBreached
6079
- ? this.props.releaseToRefreshContent
6080
- : this.props.pullDownToRefreshContent))),
6081
- this.props.children,
6082
- !this.state.showLoader &&
6083
- !hasChildren &&
6084
- this.props.hasMore &&
6085
- this.props.loader,
6086
- this.state.showLoader && this.props.hasMore && this.props.loader,
6087
- !this.props.hasMore && this.props.endMessage)));
6088
- };
6089
- return InfiniteScroll;
6090
- }(React.Component));
6091
-
6092
- var visibilitySensor = _commonjsHelpers.createCommonjsModule(function (module, exports) {
6093
- (function webpackUniversalModuleDefinition(root, factory) {
6094
- module.exports = factory(React__default, reactDom);
6095
- })(_commonjsHelpers.commonjsGlobal, function(__WEBPACK_EXTERNAL_MODULE__1__, __WEBPACK_EXTERNAL_MODULE__2__) {
6096
- return /******/ (function(modules) { // webpackBootstrap
6097
- /******/ // The module cache
6098
- /******/ var installedModules = {};
6099
- /******/
6100
- /******/ // The require function
6101
- /******/ function __webpack_require__(moduleId) {
6102
- /******/
6103
- /******/ // Check if module is in cache
6104
- /******/ if(installedModules[moduleId]) {
6105
- /******/ return installedModules[moduleId].exports;
6106
- /******/ }
6107
- /******/ // Create a new module (and put it into the cache)
6108
- /******/ var module = installedModules[moduleId] = {
6109
- /******/ i: moduleId,
6110
- /******/ l: false,
6111
- /******/ exports: {}
6112
- /******/ };
6113
- /******/
6114
- /******/ // Execute the module function
6115
- /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
6116
- /******/
6117
- /******/ // Flag the module as loaded
6118
- /******/ module.l = true;
6119
- /******/
6120
- /******/ // Return the exports of the module
6121
- /******/ return module.exports;
6122
- /******/ }
6123
- /******/
6124
- /******/
6125
- /******/ // expose the modules object (__webpack_modules__)
6126
- /******/ __webpack_require__.m = modules;
6127
- /******/
6128
- /******/ // expose the module cache
6129
- /******/ __webpack_require__.c = installedModules;
6130
- /******/
6131
- /******/ // define getter function for harmony exports
6132
- /******/ __webpack_require__.d = function(exports, name, getter) {
6133
- /******/ if(!__webpack_require__.o(exports, name)) {
6134
- /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
6135
- /******/ }
6136
- /******/ };
6137
- /******/
6138
- /******/ // define __esModule on exports
6139
- /******/ __webpack_require__.r = function(exports) {
6140
- /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
6141
- /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
6142
- /******/ }
6143
- /******/ Object.defineProperty(exports, '__esModule', { value: true });
6144
- /******/ };
6145
- /******/
6146
- /******/ // create a fake namespace object
6147
- /******/ // mode & 1: value is a module id, require it
6148
- /******/ // mode & 2: merge all properties of value into the ns
6149
- /******/ // mode & 4: return value when already ns object
6150
- /******/ // mode & 8|1: behave like require
6151
- /******/ __webpack_require__.t = function(value, mode) {
6152
- /******/ if(mode & 1) value = __webpack_require__(value);
6153
- /******/ if(mode & 8) return value;
6154
- /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
6155
- /******/ var ns = Object.create(null);
6156
- /******/ __webpack_require__.r(ns);
6157
- /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
6158
- /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
6159
- /******/ return ns;
6160
- /******/ };
6161
- /******/
6162
- /******/ // getDefaultExport function for compatibility with non-harmony modules
6163
- /******/ __webpack_require__.n = function(module) {
6164
- /******/ var getter = module && module.__esModule ?
6165
- /******/ function getDefault() { return module['default']; } :
6166
- /******/ function getModuleExports() { return module; };
6167
- /******/ __webpack_require__.d(getter, 'a', getter);
6168
- /******/ return getter;
6169
- /******/ };
6170
- /******/
6171
- /******/ // Object.prototype.hasOwnProperty.call
6172
- /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
6173
- /******/
6174
- /******/ // __webpack_public_path__
6175
- /******/ __webpack_require__.p = "";
6176
- /******/
6177
- /******/
6178
- /******/ // Load entry module and return exports
6179
- /******/ return __webpack_require__(__webpack_require__.s = 4);
6180
- /******/ })
6181
- /************************************************************************/
6182
- /******/ ([
6183
- /* 0 */
6184
- /***/ (function(module, exports, __webpack_require__) {
6185
-
6186
- /**
6187
- * Copyright (c) 2013-present, Facebook, Inc.
6188
- *
6189
- * This source code is licensed under the MIT license found in the
6190
- * LICENSE file in the root directory of this source tree.
6191
- */
6192
-
6193
- {
6194
- // By explicitly using `prop-types` you are opting into new production behavior.
6195
- // http://fb.me/prop-types-in-prod
6196
- module.exports = __webpack_require__(5)();
6197
- }
6198
-
6199
-
6200
- /***/ }),
6201
- /* 1 */
6202
- /***/ (function(module, exports) {
6203
-
6204
- module.exports = __WEBPACK_EXTERNAL_MODULE__1__;
6205
-
6206
- /***/ }),
6207
- /* 2 */
6208
- /***/ (function(module, exports) {
6209
-
6210
- module.exports = __WEBPACK_EXTERNAL_MODULE__2__;
6211
-
6212
- /***/ }),
6213
- /* 3 */
6214
- /***/ (function(module, exports) {
6215
-
6216
- // Tell whether the rect is visible, given an offset
6217
- //
6218
- // return: boolean
6219
- module.exports = function (offset, rect, containmentRect) {
6220
- var offsetDir = offset.direction;
6221
- var offsetVal = offset.value; // Rules for checking different kind of offsets. In example if the element is
6222
- // 90px below viewport and offsetTop is 100, it is considered visible.
6223
-
6224
- switch (offsetDir) {
6225
- case 'top':
6226
- return containmentRect.top + offsetVal < rect.top && containmentRect.bottom > rect.bottom && containmentRect.left < rect.left && containmentRect.right > rect.right;
6227
-
6228
- case 'left':
6229
- return containmentRect.left + offsetVal < rect.left && containmentRect.bottom > rect.bottom && containmentRect.top < rect.top && containmentRect.right > rect.right;
6230
-
6231
- case 'bottom':
6232
- return containmentRect.bottom - offsetVal > rect.bottom && containmentRect.left < rect.left && containmentRect.right > rect.right && containmentRect.top < rect.top;
6233
-
6234
- case 'right':
6235
- return containmentRect.right - offsetVal > rect.right && containmentRect.left < rect.left && containmentRect.top < rect.top && containmentRect.bottom > rect.bottom;
6236
- }
6237
- };
6238
-
6239
- /***/ }),
6240
- /* 4 */
6241
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
6242
- __webpack_require__.r(__webpack_exports__);
6243
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return VisibilitySensor; });
6244
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1);
6245
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
6246
- /* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2);
6247
- /* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_dom__WEBPACK_IMPORTED_MODULE_1__);
6248
- /* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(0);
6249
- /* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_2__);
6250
- /* harmony import */ var _lib_is_visible_with_offset__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(3);
6251
- /* harmony import */ var _lib_is_visible_with_offset__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_lib_is_visible_with_offset__WEBPACK_IMPORTED_MODULE_3__);
6252
-
6253
-
6254
- function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
6255
-
6256
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
6257
-
6258
- 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); } }
6259
-
6260
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
6261
-
6262
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
6263
-
6264
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
6265
-
6266
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
6267
-
6268
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
6269
-
6270
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
6271
-
6272
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6273
-
6274
-
6275
-
6276
-
6277
-
6278
-
6279
- function normalizeRect(rect) {
6280
- if (rect.width === undefined) {
6281
- rect.width = rect.right - rect.left;
6282
- }
6283
-
6284
- if (rect.height === undefined) {
6285
- rect.height = rect.bottom - rect.top;
6286
- }
6287
-
6288
- return rect;
6289
- }
6290
-
6291
- var VisibilitySensor =
6292
- /*#__PURE__*/
6293
- function (_React$Component) {
6294
- _inherits(VisibilitySensor, _React$Component);
6295
-
6296
- function VisibilitySensor(props) {
6297
- var _this;
6298
-
6299
- _classCallCheck(this, VisibilitySensor);
6300
-
6301
- _this = _possibleConstructorReturn(this, _getPrototypeOf(VisibilitySensor).call(this, props));
6302
-
6303
- _defineProperty(_assertThisInitialized(_this), "getContainer", function () {
6304
- return _this.props.containment || window;
6305
- });
6306
-
6307
- _defineProperty(_assertThisInitialized(_this), "addEventListener", function (target, event, delay, throttle) {
6308
- if (!_this.debounceCheck) {
6309
- _this.debounceCheck = {};
6310
- }
6311
-
6312
- var timeout;
6313
- var func;
6314
-
6315
- var later = function later() {
6316
- timeout = null;
6317
-
6318
- _this.check();
6319
- };
6320
-
6321
- if (throttle > -1) {
6322
- func = function func() {
6323
- if (!timeout) {
6324
- timeout = setTimeout(later, throttle || 0);
6325
- }
6326
- };
6327
- } else {
6328
- func = function func() {
6329
- clearTimeout(timeout);
6330
- timeout = setTimeout(later, delay || 0);
6331
- };
6332
- }
6333
-
6334
- var info = {
6335
- target: target,
6336
- fn: func,
6337
- getLastTimeout: function getLastTimeout() {
6338
- return timeout;
6339
- }
6340
- };
6341
- target.addEventListener(event, info.fn);
6342
- _this.debounceCheck[event] = info;
6343
- });
6344
-
6345
- _defineProperty(_assertThisInitialized(_this), "startWatching", function () {
6346
- if (_this.debounceCheck || _this.interval) {
6347
- return;
6348
- }
6349
-
6350
- if (_this.props.intervalCheck) {
6351
- _this.interval = setInterval(_this.check, _this.props.intervalDelay);
6352
- }
6353
-
6354
- if (_this.props.scrollCheck) {
6355
- _this.addEventListener(_this.getContainer(), "scroll", _this.props.scrollDelay, _this.props.scrollThrottle);
6356
- }
6357
-
6358
- if (_this.props.resizeCheck) {
6359
- _this.addEventListener(window, "resize", _this.props.resizeDelay, _this.props.resizeThrottle);
6360
- } // if dont need delayed call, check on load ( before the first interval fires )
6361
-
6362
-
6363
- !_this.props.delayedCall && _this.check();
6364
- });
6365
-
6366
- _defineProperty(_assertThisInitialized(_this), "stopWatching", function () {
6367
- if (_this.debounceCheck) {
6368
- // clean up event listeners and their debounce callers
6369
- for (var debounceEvent in _this.debounceCheck) {
6370
- if (_this.debounceCheck.hasOwnProperty(debounceEvent)) {
6371
- var debounceInfo = _this.debounceCheck[debounceEvent];
6372
- clearTimeout(debounceInfo.getLastTimeout());
6373
- debounceInfo.target.removeEventListener(debounceEvent, debounceInfo.fn);
6374
- _this.debounceCheck[debounceEvent] = null;
6375
- }
6376
- }
6377
- }
6378
-
6379
- _this.debounceCheck = null;
6380
-
6381
- if (_this.interval) {
6382
- _this.interval = clearInterval(_this.interval);
6383
- }
6384
- });
6385
-
6386
- _defineProperty(_assertThisInitialized(_this), "check", function () {
6387
- var el = _this.node;
6388
- var rect;
6389
- var containmentRect; // if the component has rendered to null, dont update visibility
6390
-
6391
- if (!el) {
6392
- return _this.state;
6393
- }
6394
-
6395
- rect = normalizeRect(_this.roundRectDown(el.getBoundingClientRect()));
6396
-
6397
- if (_this.props.containment) {
6398
- var containmentDOMRect = _this.props.containment.getBoundingClientRect();
6399
-
6400
- containmentRect = {
6401
- top: containmentDOMRect.top,
6402
- left: containmentDOMRect.left,
6403
- bottom: containmentDOMRect.bottom,
6404
- right: containmentDOMRect.right
6405
- };
6406
- } else {
6407
- containmentRect = {
6408
- top: 0,
6409
- left: 0,
6410
- bottom: window.innerHeight || document.documentElement.clientHeight,
6411
- right: window.innerWidth || document.documentElement.clientWidth
6412
- };
6413
- } // Check if visibility is wanted via offset?
6414
-
6415
-
6416
- var offset = _this.props.offset || {};
6417
- var hasValidOffset = _typeof(offset) === "object";
6418
-
6419
- if (hasValidOffset) {
6420
- containmentRect.top += offset.top || 0;
6421
- containmentRect.left += offset.left || 0;
6422
- containmentRect.bottom -= offset.bottom || 0;
6423
- containmentRect.right -= offset.right || 0;
6424
- }
6425
-
6426
- var visibilityRect = {
6427
- top: rect.top >= containmentRect.top,
6428
- left: rect.left >= containmentRect.left,
6429
- bottom: rect.bottom <= containmentRect.bottom,
6430
- right: rect.right <= containmentRect.right
6431
- }; // https://github.com/joshwnj/react-visibility-sensor/pull/114
6432
-
6433
- var hasSize = rect.height > 0 && rect.width > 0;
6434
- var isVisible = hasSize && visibilityRect.top && visibilityRect.left && visibilityRect.bottom && visibilityRect.right; // check for partial visibility
6435
-
6436
- if (hasSize && _this.props.partialVisibility) {
6437
- var partialVisible = rect.top <= containmentRect.bottom && rect.bottom >= containmentRect.top && rect.left <= containmentRect.right && rect.right >= containmentRect.left; // account for partial visibility on a single edge
6438
-
6439
- if (typeof _this.props.partialVisibility === "string") {
6440
- partialVisible = visibilityRect[_this.props.partialVisibility];
6441
- } // if we have minimum top visibility set by props, lets check, if it meets the passed value
6442
- // so if for instance element is at least 200px in viewport, then show it.
6443
-
6444
-
6445
- isVisible = _this.props.minTopValue ? partialVisible && rect.top <= containmentRect.bottom - _this.props.minTopValue : partialVisible;
6446
- } // Deprecated options for calculating offset.
6447
-
6448
-
6449
- if (typeof offset.direction === "string" && typeof offset.value === "number") {
6450
- console.warn("[notice] offset.direction and offset.value have been deprecated. They still work for now, but will be removed in next major version. Please upgrade to the new syntax: { %s: %d }", offset.direction, offset.value);
6451
- isVisible = _lib_is_visible_with_offset__WEBPACK_IMPORTED_MODULE_3___default()(offset, rect, containmentRect);
6452
- }
6453
-
6454
- var state = _this.state; // notify the parent when the value changes
6455
-
6456
- if (_this.state.isVisible !== isVisible) {
6457
- state = {
6458
- isVisible: isVisible,
6459
- visibilityRect: visibilityRect
6460
- };
6461
-
6462
- _this.setState(state);
6463
-
6464
- if (_this.props.onChange) _this.props.onChange(isVisible);
6465
- }
6466
-
6467
- return state;
6468
- });
6469
-
6470
- _this.state = {
6471
- isVisible: null,
6472
- visibilityRect: {}
6473
- };
6474
- return _this;
6475
- }
6476
-
6477
- _createClass(VisibilitySensor, [{
6478
- key: "componentDidMount",
6479
- value: function componentDidMount() {
6480
- this.node = react_dom__WEBPACK_IMPORTED_MODULE_1___default.a.findDOMNode(this);
6481
-
6482
- if (this.props.active) {
6483
- this.startWatching();
6484
- }
6485
- }
6486
- }, {
6487
- key: "componentWillUnmount",
6488
- value: function componentWillUnmount() {
6489
- this.stopWatching();
6490
- }
6491
- }, {
6492
- key: "componentDidUpdate",
6493
- value: function componentDidUpdate(prevProps) {
6494
- // re-register node in componentDidUpdate if children diffs [#103]
6495
- this.node = react_dom__WEBPACK_IMPORTED_MODULE_1___default.a.findDOMNode(this);
6496
-
6497
- if (this.props.active && !prevProps.active) {
6498
- this.setState({
6499
- isVisible: null,
6500
- visibilityRect: {}
6501
- });
6502
- this.startWatching();
6503
- } else if (!this.props.active) {
6504
- this.stopWatching();
6505
- }
6506
- }
6507
- }, {
6508
- key: "roundRectDown",
6509
- value: function roundRectDown(rect) {
6510
- return {
6511
- top: Math.floor(rect.top),
6512
- left: Math.floor(rect.left),
6513
- bottom: Math.floor(rect.bottom),
6514
- right: Math.floor(rect.right)
6515
- };
6516
- }
6517
- /**
6518
- * Check if the element is within the visible viewport
6519
- */
6520
-
6521
- }, {
6522
- key: "render",
6523
- value: function render() {
6524
- if (this.props.children instanceof Function) {
6525
- return this.props.children({
6526
- isVisible: this.state.isVisible,
6527
- visibilityRect: this.state.visibilityRect
6528
- });
6529
- }
6530
-
6531
- return react__WEBPACK_IMPORTED_MODULE_0___default.a.Children.only(this.props.children);
6532
- }
6533
- }]);
6534
-
6535
- return VisibilitySensor;
6536
- }(react__WEBPACK_IMPORTED_MODULE_0___default.a.Component);
6537
-
6538
- _defineProperty(VisibilitySensor, "defaultProps", {
6539
- active: true,
6540
- partialVisibility: false,
6541
- minTopValue: 0,
6542
- scrollCheck: false,
6543
- scrollDelay: 250,
6544
- scrollThrottle: -1,
6545
- resizeCheck: false,
6546
- resizeDelay: 250,
6547
- resizeThrottle: -1,
6548
- intervalCheck: true,
6549
- intervalDelay: 100,
6550
- delayedCall: false,
6551
- offset: {},
6552
- containment: null,
6553
- children: react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("span", null)
6554
- });
6555
-
6556
- _defineProperty(VisibilitySensor, "propTypes", {
6557
- onChange: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.func,
6558
- active: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.bool,
6559
- partialVisibility: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.oneOfType([prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.bool, prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.oneOf(["top", "right", "bottom", "left"])]),
6560
- delayedCall: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.bool,
6561
- offset: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.oneOfType([prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.shape({
6562
- top: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
6563
- left: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
6564
- bottom: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
6565
- right: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number
6566
- }), // deprecated offset property
6567
- prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.shape({
6568
- direction: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.oneOf(["top", "right", "bottom", "left"]),
6569
- value: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number
6570
- })]),
6571
- scrollCheck: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.bool,
6572
- scrollDelay: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
6573
- scrollThrottle: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
6574
- resizeCheck: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.bool,
6575
- resizeDelay: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
6576
- resizeThrottle: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
6577
- intervalCheck: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.bool,
6578
- intervalDelay: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
6579
- containment: typeof window !== "undefined" ? prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.instanceOf(window.Element) : prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.any,
6580
- children: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.oneOfType([prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.element, prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.func]),
6581
- minTopValue: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number
6582
- });
6583
-
6584
-
6585
-
6586
- /***/ }),
6587
- /* 5 */
6588
- /***/ (function(module, exports, __webpack_require__) {
6589
- /**
6590
- * Copyright (c) 2013-present, Facebook, Inc.
6591
- *
6592
- * This source code is licensed under the MIT license found in the
6593
- * LICENSE file in the root directory of this source tree.
6594
- */
6595
-
6596
-
6597
-
6598
- var ReactPropTypesSecret = __webpack_require__(6);
6599
-
6600
- function emptyFunction() {}
6601
- function emptyFunctionWithReset() {}
6602
- emptyFunctionWithReset.resetWarningCache = emptyFunction;
6603
-
6604
- module.exports = function() {
6605
- function shim(props, propName, componentName, location, propFullName, secret) {
6606
- if (secret === ReactPropTypesSecret) {
6607
- // It is still safe when called from React.
6608
- return;
6609
- }
6610
- var err = new Error(
6611
- 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
6612
- 'Use PropTypes.checkPropTypes() to call them. ' +
6613
- 'Read more at http://fb.me/use-check-prop-types'
6614
- );
6615
- err.name = 'Invariant Violation';
6616
- throw err;
6617
- } shim.isRequired = shim;
6618
- function getShim() {
6619
- return shim;
6620
- } // Important!
6621
- // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
6622
- var ReactPropTypes = {
6623
- array: shim,
6624
- bool: shim,
6625
- func: shim,
6626
- number: shim,
6627
- object: shim,
6628
- string: shim,
6629
- symbol: shim,
6630
-
6631
- any: shim,
6632
- arrayOf: getShim,
6633
- element: shim,
6634
- elementType: shim,
6635
- instanceOf: getShim,
6636
- node: shim,
6637
- objectOf: getShim,
6638
- oneOf: getShim,
6639
- oneOfType: getShim,
6640
- shape: getShim,
6641
- exact: getShim,
6642
-
6643
- checkPropTypes: emptyFunctionWithReset,
6644
- resetWarningCache: emptyFunction
6645
- };
6646
-
6647
- ReactPropTypes.PropTypes = ReactPropTypes;
6648
-
6649
- return ReactPropTypes;
6650
- };
6651
-
6652
-
6653
- /***/ }),
6654
- /* 6 */
6655
- /***/ (function(module, exports, __webpack_require__) {
6656
- /**
6657
- * Copyright (c) 2013-present, Facebook, Inc.
6658
- *
6659
- * This source code is licensed under the MIT license found in the
6660
- * LICENSE file in the root directory of this source tree.
6661
- */
6662
-
6663
-
6664
-
6665
- var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
6666
-
6667
- module.exports = ReactPropTypesSecret;
6668
-
6669
-
6670
- /***/ })
6671
- /******/ ]);
6672
- });
6673
- });
6674
-
6675
- var VisibilitySensor = _commonjsHelpers.unwrapExports(visibilitySensor);
6676
-
6677
- exports.InfiniteScroll = InfiniteScroll;
6678
- exports.VisibilitySensor = VisibilitySensor;
6679
5667
  exports.moment = moment;