@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.
- package/README.md +1 -1
- package/dist/cjs/{ADInfeed-b042a194.js → ADInfeed-43996091.js} +10 -1
- package/dist/cjs/DeckContent.js +4 -3
- package/dist/cjs/DeckQueue.js +3 -2
- package/dist/cjs/{Dfp-9ede68c7.js → Dfp-e77be4e4.js} +1 -1
- package/dist/cjs/{GridContent-609021de.js → GridContent-7a85d904.js} +8 -7
- package/dist/cjs/GridContent.js +4 -3
- package/dist/cjs/IssueContentDeck.js +168 -43
- package/dist/cjs/MasterDeck.js +2 -1
- package/dist/cjs/QueueDeckExpanded.js +6 -5
- package/dist/cjs/VideoSeriesListing.js +2 -1
- package/dist/cjs/index.js +19 -18
- package/dist/cjs/{visibility-sensor-c2ccc22d.js → moment-66a6a284.js} +0 -1012
- package/dist/cjs/visibility-sensor-43e0b37c.js +1016 -0
- package/dist/esm/{ADInfeed-aadcfc25.js → ADInfeed-ca26fca6.js} +10 -1
- package/dist/esm/DeckContent.js +3 -2
- package/dist/esm/DeckQueue.js +2 -1
- package/dist/esm/{Dfp-9293acfb.js → Dfp-7c317aa4.js} +1 -1
- package/dist/esm/{GridContent-f2278de3.js → GridContent-e2b1de22.js} +4 -3
- package/dist/esm/GridContent.js +4 -3
- package/dist/esm/IssueContentDeck.js +168 -43
- package/dist/esm/MasterDeck.js +2 -1
- package/dist/esm/QueueDeckExpanded.js +3 -2
- package/dist/esm/VideoSeriesListing.js +2 -1
- package/dist/esm/index.js +4 -3
- package/dist/esm/{visibility-sensor-3cea5efb.js → moment-12415288.js} +2 -1009
- package/dist/esm/visibility-sensor-49d5805d.js +1010 -0
- package/package.json +1 -1
|
@@ -0,0 +1,1010 @@
|
|
|
1
|
+
import { c as createCommonjsModule, a as commonjsGlobal, u as unwrapExports } from './_commonjsHelpers-0c4b6f40.js';
|
|
2
|
+
import React__default, { Component } from 'react';
|
|
3
|
+
import reactDom from 'react-dom';
|
|
4
|
+
|
|
5
|
+
/*! *****************************************************************************
|
|
6
|
+
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
7
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
8
|
+
this file except in compliance with the License. You may obtain a copy of the
|
|
9
|
+
License at http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
|
|
11
|
+
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
12
|
+
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
|
13
|
+
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
|
14
|
+
MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
15
|
+
|
|
16
|
+
See the Apache Version 2.0 License for specific language governing permissions
|
|
17
|
+
and limitations under the License.
|
|
18
|
+
***************************************************************************** */
|
|
19
|
+
/* global Reflect, Promise */
|
|
20
|
+
|
|
21
|
+
var extendStatics = function(d, b) {
|
|
22
|
+
extendStatics = Object.setPrototypeOf ||
|
|
23
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
24
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
25
|
+
return extendStatics(d, b);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
function __extends(d, b) {
|
|
29
|
+
extendStatics(d, b);
|
|
30
|
+
function __() { this.constructor = d; }
|
|
31
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
var __assign = function() {
|
|
35
|
+
__assign = Object.assign || function __assign(t) {
|
|
36
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
37
|
+
s = arguments[i];
|
|
38
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
39
|
+
}
|
|
40
|
+
return t;
|
|
41
|
+
};
|
|
42
|
+
return __assign.apply(this, arguments);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
/* eslint-disable no-undefined,no-param-reassign,no-shadow */
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Throttle execution of a function. Especially useful for rate limiting
|
|
49
|
+
* execution of handlers on events like resize and scroll.
|
|
50
|
+
*
|
|
51
|
+
* @param {Number} delay A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful.
|
|
52
|
+
* @param {Boolean} [noTrailing] Optional, defaults to false. If noTrailing is true, callback will only execute every `delay` milliseconds while the
|
|
53
|
+
* throttled-function is being called. If noTrailing is false or unspecified, callback will be executed one final time
|
|
54
|
+
* after the last throttled-function call. (After the throttled-function has not been called for `delay` milliseconds,
|
|
55
|
+
* the internal counter is reset)
|
|
56
|
+
* @param {Function} callback A function to be executed after delay milliseconds. The `this` context and all arguments are passed through, as-is,
|
|
57
|
+
* to `callback` when the throttled-function is executed.
|
|
58
|
+
* @param {Boolean} [debounceMode] If `debounceMode` is true (at begin), schedule `clear` to execute after `delay` ms. If `debounceMode` is false (at end),
|
|
59
|
+
* schedule `callback` to execute after `delay` ms.
|
|
60
|
+
*
|
|
61
|
+
* @return {Function} A new, throttled, function.
|
|
62
|
+
*/
|
|
63
|
+
function throttle (delay, noTrailing, callback, debounceMode) {
|
|
64
|
+
/*
|
|
65
|
+
* After wrapper has stopped being called, this timeout ensures that
|
|
66
|
+
* `callback` is executed at the proper times in `throttle` and `end`
|
|
67
|
+
* debounce modes.
|
|
68
|
+
*/
|
|
69
|
+
var timeoutID;
|
|
70
|
+
var cancelled = false; // Keep track of the last time `callback` was executed.
|
|
71
|
+
|
|
72
|
+
var lastExec = 0; // Function to clear existing timeout
|
|
73
|
+
|
|
74
|
+
function clearExistingTimeout() {
|
|
75
|
+
if (timeoutID) {
|
|
76
|
+
clearTimeout(timeoutID);
|
|
77
|
+
}
|
|
78
|
+
} // Function to cancel next exec
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
function cancel() {
|
|
82
|
+
clearExistingTimeout();
|
|
83
|
+
cancelled = true;
|
|
84
|
+
} // `noTrailing` defaults to falsy.
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
if (typeof noTrailing !== 'boolean') {
|
|
88
|
+
debounceMode = callback;
|
|
89
|
+
callback = noTrailing;
|
|
90
|
+
noTrailing = undefined;
|
|
91
|
+
}
|
|
92
|
+
/*
|
|
93
|
+
* The `wrapper` function encapsulates all of the throttling / debouncing
|
|
94
|
+
* functionality and when executed will limit the rate at which `callback`
|
|
95
|
+
* is executed.
|
|
96
|
+
*/
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
function wrapper() {
|
|
100
|
+
var self = this;
|
|
101
|
+
var elapsed = Date.now() - lastExec;
|
|
102
|
+
var args = arguments;
|
|
103
|
+
|
|
104
|
+
if (cancelled) {
|
|
105
|
+
return;
|
|
106
|
+
} // Execute `callback` and update the `lastExec` timestamp.
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
function exec() {
|
|
110
|
+
lastExec = Date.now();
|
|
111
|
+
callback.apply(self, args);
|
|
112
|
+
}
|
|
113
|
+
/*
|
|
114
|
+
* If `debounceMode` is true (at begin) this is used to clear the flag
|
|
115
|
+
* to allow future `callback` executions.
|
|
116
|
+
*/
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
function clear() {
|
|
120
|
+
timeoutID = undefined;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
if (debounceMode && !timeoutID) {
|
|
124
|
+
/*
|
|
125
|
+
* Since `wrapper` is being called for the first time and
|
|
126
|
+
* `debounceMode` is true (at begin), execute `callback`.
|
|
127
|
+
*/
|
|
128
|
+
exec();
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
clearExistingTimeout();
|
|
132
|
+
|
|
133
|
+
if (debounceMode === undefined && elapsed > delay) {
|
|
134
|
+
/*
|
|
135
|
+
* In throttle mode, if `delay` time has been exceeded, execute
|
|
136
|
+
* `callback`.
|
|
137
|
+
*/
|
|
138
|
+
exec();
|
|
139
|
+
} else if (noTrailing !== true) {
|
|
140
|
+
/*
|
|
141
|
+
* In trailing throttle mode, since `delay` time has not been
|
|
142
|
+
* exceeded, schedule `callback` to execute `delay` ms after most
|
|
143
|
+
* recent execution.
|
|
144
|
+
*
|
|
145
|
+
* If `debounceMode` is true (at begin), schedule `clear` to execute
|
|
146
|
+
* after `delay` ms.
|
|
147
|
+
*
|
|
148
|
+
* If `debounceMode` is false (at end), schedule `callback` to
|
|
149
|
+
* execute after `delay` ms.
|
|
150
|
+
*/
|
|
151
|
+
timeoutID = setTimeout(debounceMode ? clear : exec, debounceMode === undefined ? delay - elapsed : delay);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
wrapper.cancel = cancel; // Return the wrapper function.
|
|
156
|
+
|
|
157
|
+
return wrapper;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
var ThresholdUnits = {
|
|
161
|
+
Pixel: 'Pixel',
|
|
162
|
+
Percent: 'Percent',
|
|
163
|
+
};
|
|
164
|
+
var defaultThreshold = {
|
|
165
|
+
unit: ThresholdUnits.Percent,
|
|
166
|
+
value: 0.8,
|
|
167
|
+
};
|
|
168
|
+
function parseThreshold(scrollThreshold) {
|
|
169
|
+
if (typeof scrollThreshold === 'number') {
|
|
170
|
+
return {
|
|
171
|
+
unit: ThresholdUnits.Percent,
|
|
172
|
+
value: scrollThreshold * 100,
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
if (typeof scrollThreshold === 'string') {
|
|
176
|
+
if (scrollThreshold.match(/^(\d*(\.\d+)?)px$/)) {
|
|
177
|
+
return {
|
|
178
|
+
unit: ThresholdUnits.Pixel,
|
|
179
|
+
value: parseFloat(scrollThreshold),
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
if (scrollThreshold.match(/^(\d*(\.\d+)?)%$/)) {
|
|
183
|
+
return {
|
|
184
|
+
unit: ThresholdUnits.Percent,
|
|
185
|
+
value: parseFloat(scrollThreshold),
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
console.warn('scrollThreshold format is invalid. Valid formats: "120px", "50%"...');
|
|
189
|
+
return defaultThreshold;
|
|
190
|
+
}
|
|
191
|
+
console.warn('scrollThreshold should be string or number');
|
|
192
|
+
return defaultThreshold;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
var InfiniteScroll = /** @class */ (function (_super) {
|
|
196
|
+
__extends(InfiniteScroll, _super);
|
|
197
|
+
function InfiniteScroll(props) {
|
|
198
|
+
var _this = _super.call(this, props) || this;
|
|
199
|
+
_this.lastScrollTop = 0;
|
|
200
|
+
_this.actionTriggered = false;
|
|
201
|
+
// variables to keep track of pull down behaviour
|
|
202
|
+
_this.startY = 0;
|
|
203
|
+
_this.currentY = 0;
|
|
204
|
+
_this.dragging = false;
|
|
205
|
+
// will be populated in componentDidMount
|
|
206
|
+
// based on the height of the pull down element
|
|
207
|
+
_this.maxPullDownDistance = 0;
|
|
208
|
+
_this.getScrollableTarget = function () {
|
|
209
|
+
if (_this.props.scrollableTarget instanceof HTMLElement)
|
|
210
|
+
return _this.props.scrollableTarget;
|
|
211
|
+
if (typeof _this.props.scrollableTarget === 'string') {
|
|
212
|
+
return document.getElementById(_this.props.scrollableTarget);
|
|
213
|
+
}
|
|
214
|
+
if (_this.props.scrollableTarget === null) {
|
|
215
|
+
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 ");
|
|
216
|
+
}
|
|
217
|
+
return null;
|
|
218
|
+
};
|
|
219
|
+
_this.onStart = function (evt) {
|
|
220
|
+
if (_this.lastScrollTop)
|
|
221
|
+
return;
|
|
222
|
+
_this.dragging = true;
|
|
223
|
+
if (evt instanceof MouseEvent) {
|
|
224
|
+
_this.startY = evt.pageY;
|
|
225
|
+
}
|
|
226
|
+
else if (evt instanceof TouchEvent) {
|
|
227
|
+
_this.startY = evt.touches[0].pageY;
|
|
228
|
+
}
|
|
229
|
+
_this.currentY = _this.startY;
|
|
230
|
+
if (_this._infScroll) {
|
|
231
|
+
_this._infScroll.style.willChange = 'transform';
|
|
232
|
+
_this._infScroll.style.transition = "transform 0.2s cubic-bezier(0,0,0.31,1)";
|
|
233
|
+
}
|
|
234
|
+
};
|
|
235
|
+
_this.onMove = function (evt) {
|
|
236
|
+
if (!_this.dragging)
|
|
237
|
+
return;
|
|
238
|
+
if (evt instanceof MouseEvent) {
|
|
239
|
+
_this.currentY = evt.pageY;
|
|
240
|
+
}
|
|
241
|
+
else if (evt instanceof TouchEvent) {
|
|
242
|
+
_this.currentY = evt.touches[0].pageY;
|
|
243
|
+
}
|
|
244
|
+
// user is scrolling down to up
|
|
245
|
+
if (_this.currentY < _this.startY)
|
|
246
|
+
return;
|
|
247
|
+
if (_this.currentY - _this.startY >=
|
|
248
|
+
Number(_this.props.pullDownToRefreshThreshold)) {
|
|
249
|
+
_this.setState({
|
|
250
|
+
pullToRefreshThresholdBreached: true,
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
// so you can drag upto 1.5 times of the maxPullDownDistance
|
|
254
|
+
if (_this.currentY - _this.startY > _this.maxPullDownDistance * 1.5)
|
|
255
|
+
return;
|
|
256
|
+
if (_this._infScroll) {
|
|
257
|
+
_this._infScroll.style.overflow = 'visible';
|
|
258
|
+
_this._infScroll.style.transform = "translate3d(0px, " + (_this.currentY -
|
|
259
|
+
_this.startY) + "px, 0px)";
|
|
260
|
+
}
|
|
261
|
+
};
|
|
262
|
+
_this.onEnd = function () {
|
|
263
|
+
_this.startY = 0;
|
|
264
|
+
_this.currentY = 0;
|
|
265
|
+
_this.dragging = false;
|
|
266
|
+
if (_this.state.pullToRefreshThresholdBreached) {
|
|
267
|
+
_this.props.refreshFunction && _this.props.refreshFunction();
|
|
268
|
+
_this.setState({
|
|
269
|
+
pullToRefreshThresholdBreached: false,
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
requestAnimationFrame(function () {
|
|
273
|
+
// this._infScroll
|
|
274
|
+
if (_this._infScroll) {
|
|
275
|
+
_this._infScroll.style.overflow = 'auto';
|
|
276
|
+
_this._infScroll.style.transform = 'none';
|
|
277
|
+
_this._infScroll.style.willChange = 'none';
|
|
278
|
+
}
|
|
279
|
+
});
|
|
280
|
+
};
|
|
281
|
+
_this.onScrollListener = function (event) {
|
|
282
|
+
if (typeof _this.props.onScroll === 'function') {
|
|
283
|
+
// Execute this callback in next tick so that it does not affect the
|
|
284
|
+
// functionality of the library.
|
|
285
|
+
setTimeout(function () { return _this.props.onScroll && _this.props.onScroll(event); }, 0);
|
|
286
|
+
}
|
|
287
|
+
var target = _this.props.height || _this._scrollableNode
|
|
288
|
+
? event.target
|
|
289
|
+
: document.documentElement.scrollTop
|
|
290
|
+
? document.documentElement
|
|
291
|
+
: document.body;
|
|
292
|
+
// return immediately if the action has already been triggered,
|
|
293
|
+
// prevents multiple triggers.
|
|
294
|
+
if (_this.actionTriggered)
|
|
295
|
+
return;
|
|
296
|
+
var atBottom = _this.isElementAtBottom(target, _this.props.scrollThreshold);
|
|
297
|
+
// call the `next` function in the props to trigger the next data fetch
|
|
298
|
+
if (atBottom && _this.props.hasMore) {
|
|
299
|
+
_this.actionTriggered = true;
|
|
300
|
+
_this.setState({ showLoader: true });
|
|
301
|
+
_this.props.next && _this.props.next();
|
|
302
|
+
}
|
|
303
|
+
_this.lastScrollTop = target.scrollTop;
|
|
304
|
+
};
|
|
305
|
+
_this.state = {
|
|
306
|
+
showLoader: false,
|
|
307
|
+
pullToRefreshThresholdBreached: false,
|
|
308
|
+
};
|
|
309
|
+
_this.throttledOnScrollListener = throttle(150, _this.onScrollListener).bind(_this);
|
|
310
|
+
_this.onStart = _this.onStart.bind(_this);
|
|
311
|
+
_this.onMove = _this.onMove.bind(_this);
|
|
312
|
+
_this.onEnd = _this.onEnd.bind(_this);
|
|
313
|
+
return _this;
|
|
314
|
+
}
|
|
315
|
+
InfiniteScroll.prototype.componentDidMount = function () {
|
|
316
|
+
if (typeof this.props.dataLength === 'undefined') {
|
|
317
|
+
throw new Error("mandatory prop \"dataLength\" is missing. The prop is needed" +
|
|
318
|
+
" when loading more content. Check README.md for usage");
|
|
319
|
+
}
|
|
320
|
+
this._scrollableNode = this.getScrollableTarget();
|
|
321
|
+
this.el = this.props.height
|
|
322
|
+
? this._infScroll
|
|
323
|
+
: this._scrollableNode || window;
|
|
324
|
+
if (this.el) {
|
|
325
|
+
this.el.addEventListener('scroll', this
|
|
326
|
+
.throttledOnScrollListener);
|
|
327
|
+
}
|
|
328
|
+
if (typeof this.props.initialScrollY === 'number' &&
|
|
329
|
+
this.el &&
|
|
330
|
+
this.el instanceof HTMLElement &&
|
|
331
|
+
this.el.scrollHeight > this.props.initialScrollY) {
|
|
332
|
+
this.el.scrollTo(0, this.props.initialScrollY);
|
|
333
|
+
}
|
|
334
|
+
if (this.props.pullDownToRefresh && this.el) {
|
|
335
|
+
this.el.addEventListener('touchstart', this.onStart);
|
|
336
|
+
this.el.addEventListener('touchmove', this.onMove);
|
|
337
|
+
this.el.addEventListener('touchend', this.onEnd);
|
|
338
|
+
this.el.addEventListener('mousedown', this.onStart);
|
|
339
|
+
this.el.addEventListener('mousemove', this.onMove);
|
|
340
|
+
this.el.addEventListener('mouseup', this.onEnd);
|
|
341
|
+
// get BCR of pullDown element to position it above
|
|
342
|
+
this.maxPullDownDistance =
|
|
343
|
+
(this._pullDown &&
|
|
344
|
+
this._pullDown.firstChild &&
|
|
345
|
+
this._pullDown.firstChild.getBoundingClientRect()
|
|
346
|
+
.height) ||
|
|
347
|
+
0;
|
|
348
|
+
this.forceUpdate();
|
|
349
|
+
if (typeof this.props.refreshFunction !== 'function') {
|
|
350
|
+
throw new Error("Mandatory prop \"refreshFunction\" missing.\n Pull Down To Refresh functionality will not work\n as expected. Check README.md for usage'");
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
};
|
|
354
|
+
InfiniteScroll.prototype.componentWillUnmount = function () {
|
|
355
|
+
if (this.el) {
|
|
356
|
+
this.el.removeEventListener('scroll', this
|
|
357
|
+
.throttledOnScrollListener);
|
|
358
|
+
if (this.props.pullDownToRefresh) {
|
|
359
|
+
this.el.removeEventListener('touchstart', this.onStart);
|
|
360
|
+
this.el.removeEventListener('touchmove', this.onMove);
|
|
361
|
+
this.el.removeEventListener('touchend', this.onEnd);
|
|
362
|
+
this.el.removeEventListener('mousedown', this.onStart);
|
|
363
|
+
this.el.removeEventListener('mousemove', this.onMove);
|
|
364
|
+
this.el.removeEventListener('mouseup', this.onEnd);
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
};
|
|
368
|
+
InfiniteScroll.prototype.UNSAFE_componentWillReceiveProps = function (props) {
|
|
369
|
+
// do nothing when dataLength and key are unchanged
|
|
370
|
+
if (this.props.key === props.key &&
|
|
371
|
+
this.props.dataLength === props.dataLength)
|
|
372
|
+
return;
|
|
373
|
+
this.actionTriggered = false;
|
|
374
|
+
// update state when new data was sent in
|
|
375
|
+
this.setState({
|
|
376
|
+
showLoader: false,
|
|
377
|
+
});
|
|
378
|
+
};
|
|
379
|
+
InfiniteScroll.prototype.isElementAtBottom = function (target, scrollThreshold) {
|
|
380
|
+
if (scrollThreshold === void 0) { scrollThreshold = 0.8; }
|
|
381
|
+
var clientHeight = target === document.body || target === document.documentElement
|
|
382
|
+
? window.screen.availHeight
|
|
383
|
+
: target.clientHeight;
|
|
384
|
+
var threshold = parseThreshold(scrollThreshold);
|
|
385
|
+
if (threshold.unit === ThresholdUnits.Pixel) {
|
|
386
|
+
return (target.scrollTop + clientHeight >= target.scrollHeight - threshold.value);
|
|
387
|
+
}
|
|
388
|
+
return (target.scrollTop + clientHeight >=
|
|
389
|
+
(threshold.value / 100) * target.scrollHeight);
|
|
390
|
+
};
|
|
391
|
+
InfiniteScroll.prototype.render = function () {
|
|
392
|
+
var _this = this;
|
|
393
|
+
var style = __assign({ height: this.props.height || 'auto', overflow: 'auto', WebkitOverflowScrolling: 'touch' }, this.props.style);
|
|
394
|
+
var hasChildren = this.props.hasChildren ||
|
|
395
|
+
!!(this.props.children &&
|
|
396
|
+
this.props.children instanceof Array &&
|
|
397
|
+
this.props.children.length);
|
|
398
|
+
// because heighted infiniteScroll visualy breaks
|
|
399
|
+
// on drag down as overflow becomes visible
|
|
400
|
+
var outerDivStyle = this.props.pullDownToRefresh && this.props.height
|
|
401
|
+
? { overflow: 'auto' }
|
|
402
|
+
: {};
|
|
403
|
+
return (React__default.createElement("div", { style: outerDivStyle, className: "infinite-scroll-component__outerdiv" },
|
|
404
|
+
React__default.createElement("div", { className: "infinite-scroll-component " + (this.props.className || ''), ref: function (infScroll) { return (_this._infScroll = infScroll); }, style: style },
|
|
405
|
+
this.props.pullDownToRefresh && (React__default.createElement("div", { style: { position: 'relative' }, ref: function (pullDown) { return (_this._pullDown = pullDown); } },
|
|
406
|
+
React__default.createElement("div", { style: {
|
|
407
|
+
position: 'absolute',
|
|
408
|
+
left: 0,
|
|
409
|
+
right: 0,
|
|
410
|
+
top: -1 * this.maxPullDownDistance,
|
|
411
|
+
} }, this.state.pullToRefreshThresholdBreached
|
|
412
|
+
? this.props.releaseToRefreshContent
|
|
413
|
+
: this.props.pullDownToRefreshContent))),
|
|
414
|
+
this.props.children,
|
|
415
|
+
!this.state.showLoader &&
|
|
416
|
+
!hasChildren &&
|
|
417
|
+
this.props.hasMore &&
|
|
418
|
+
this.props.loader,
|
|
419
|
+
this.state.showLoader && this.props.hasMore && this.props.loader,
|
|
420
|
+
!this.props.hasMore && this.props.endMessage)));
|
|
421
|
+
};
|
|
422
|
+
return InfiniteScroll;
|
|
423
|
+
}(Component));
|
|
424
|
+
|
|
425
|
+
var visibilitySensor = createCommonjsModule(function (module, exports) {
|
|
426
|
+
(function webpackUniversalModuleDefinition(root, factory) {
|
|
427
|
+
module.exports = factory(React__default, reactDom);
|
|
428
|
+
})(commonjsGlobal, function(__WEBPACK_EXTERNAL_MODULE__1__, __WEBPACK_EXTERNAL_MODULE__2__) {
|
|
429
|
+
return /******/ (function(modules) { // webpackBootstrap
|
|
430
|
+
/******/ // The module cache
|
|
431
|
+
/******/ var installedModules = {};
|
|
432
|
+
/******/
|
|
433
|
+
/******/ // The require function
|
|
434
|
+
/******/ function __webpack_require__(moduleId) {
|
|
435
|
+
/******/
|
|
436
|
+
/******/ // Check if module is in cache
|
|
437
|
+
/******/ if(installedModules[moduleId]) {
|
|
438
|
+
/******/ return installedModules[moduleId].exports;
|
|
439
|
+
/******/ }
|
|
440
|
+
/******/ // Create a new module (and put it into the cache)
|
|
441
|
+
/******/ var module = installedModules[moduleId] = {
|
|
442
|
+
/******/ i: moduleId,
|
|
443
|
+
/******/ l: false,
|
|
444
|
+
/******/ exports: {}
|
|
445
|
+
/******/ };
|
|
446
|
+
/******/
|
|
447
|
+
/******/ // Execute the module function
|
|
448
|
+
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
|
449
|
+
/******/
|
|
450
|
+
/******/ // Flag the module as loaded
|
|
451
|
+
/******/ module.l = true;
|
|
452
|
+
/******/
|
|
453
|
+
/******/ // Return the exports of the module
|
|
454
|
+
/******/ return module.exports;
|
|
455
|
+
/******/ }
|
|
456
|
+
/******/
|
|
457
|
+
/******/
|
|
458
|
+
/******/ // expose the modules object (__webpack_modules__)
|
|
459
|
+
/******/ __webpack_require__.m = modules;
|
|
460
|
+
/******/
|
|
461
|
+
/******/ // expose the module cache
|
|
462
|
+
/******/ __webpack_require__.c = installedModules;
|
|
463
|
+
/******/
|
|
464
|
+
/******/ // define getter function for harmony exports
|
|
465
|
+
/******/ __webpack_require__.d = function(exports, name, getter) {
|
|
466
|
+
/******/ if(!__webpack_require__.o(exports, name)) {
|
|
467
|
+
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
|
468
|
+
/******/ }
|
|
469
|
+
/******/ };
|
|
470
|
+
/******/
|
|
471
|
+
/******/ // define __esModule on exports
|
|
472
|
+
/******/ __webpack_require__.r = function(exports) {
|
|
473
|
+
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
474
|
+
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
475
|
+
/******/ }
|
|
476
|
+
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
|
477
|
+
/******/ };
|
|
478
|
+
/******/
|
|
479
|
+
/******/ // create a fake namespace object
|
|
480
|
+
/******/ // mode & 1: value is a module id, require it
|
|
481
|
+
/******/ // mode & 2: merge all properties of value into the ns
|
|
482
|
+
/******/ // mode & 4: return value when already ns object
|
|
483
|
+
/******/ // mode & 8|1: behave like require
|
|
484
|
+
/******/ __webpack_require__.t = function(value, mode) {
|
|
485
|
+
/******/ if(mode & 1) value = __webpack_require__(value);
|
|
486
|
+
/******/ if(mode & 8) return value;
|
|
487
|
+
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
|
488
|
+
/******/ var ns = Object.create(null);
|
|
489
|
+
/******/ __webpack_require__.r(ns);
|
|
490
|
+
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
|
491
|
+
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
|
492
|
+
/******/ return ns;
|
|
493
|
+
/******/ };
|
|
494
|
+
/******/
|
|
495
|
+
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
|
496
|
+
/******/ __webpack_require__.n = function(module) {
|
|
497
|
+
/******/ var getter = module && module.__esModule ?
|
|
498
|
+
/******/ function getDefault() { return module['default']; } :
|
|
499
|
+
/******/ function getModuleExports() { return module; };
|
|
500
|
+
/******/ __webpack_require__.d(getter, 'a', getter);
|
|
501
|
+
/******/ return getter;
|
|
502
|
+
/******/ };
|
|
503
|
+
/******/
|
|
504
|
+
/******/ // Object.prototype.hasOwnProperty.call
|
|
505
|
+
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
|
506
|
+
/******/
|
|
507
|
+
/******/ // __webpack_public_path__
|
|
508
|
+
/******/ __webpack_require__.p = "";
|
|
509
|
+
/******/
|
|
510
|
+
/******/
|
|
511
|
+
/******/ // Load entry module and return exports
|
|
512
|
+
/******/ return __webpack_require__(__webpack_require__.s = 4);
|
|
513
|
+
/******/ })
|
|
514
|
+
/************************************************************************/
|
|
515
|
+
/******/ ([
|
|
516
|
+
/* 0 */
|
|
517
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
518
|
+
|
|
519
|
+
/**
|
|
520
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
521
|
+
*
|
|
522
|
+
* This source code is licensed under the MIT license found in the
|
|
523
|
+
* LICENSE file in the root directory of this source tree.
|
|
524
|
+
*/
|
|
525
|
+
|
|
526
|
+
{
|
|
527
|
+
// By explicitly using `prop-types` you are opting into new production behavior.
|
|
528
|
+
// http://fb.me/prop-types-in-prod
|
|
529
|
+
module.exports = __webpack_require__(5)();
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
|
|
533
|
+
/***/ }),
|
|
534
|
+
/* 1 */
|
|
535
|
+
/***/ (function(module, exports) {
|
|
536
|
+
|
|
537
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE__1__;
|
|
538
|
+
|
|
539
|
+
/***/ }),
|
|
540
|
+
/* 2 */
|
|
541
|
+
/***/ (function(module, exports) {
|
|
542
|
+
|
|
543
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE__2__;
|
|
544
|
+
|
|
545
|
+
/***/ }),
|
|
546
|
+
/* 3 */
|
|
547
|
+
/***/ (function(module, exports) {
|
|
548
|
+
|
|
549
|
+
// Tell whether the rect is visible, given an offset
|
|
550
|
+
//
|
|
551
|
+
// return: boolean
|
|
552
|
+
module.exports = function (offset, rect, containmentRect) {
|
|
553
|
+
var offsetDir = offset.direction;
|
|
554
|
+
var offsetVal = offset.value; // Rules for checking different kind of offsets. In example if the element is
|
|
555
|
+
// 90px below viewport and offsetTop is 100, it is considered visible.
|
|
556
|
+
|
|
557
|
+
switch (offsetDir) {
|
|
558
|
+
case 'top':
|
|
559
|
+
return containmentRect.top + offsetVal < rect.top && containmentRect.bottom > rect.bottom && containmentRect.left < rect.left && containmentRect.right > rect.right;
|
|
560
|
+
|
|
561
|
+
case 'left':
|
|
562
|
+
return containmentRect.left + offsetVal < rect.left && containmentRect.bottom > rect.bottom && containmentRect.top < rect.top && containmentRect.right > rect.right;
|
|
563
|
+
|
|
564
|
+
case 'bottom':
|
|
565
|
+
return containmentRect.bottom - offsetVal > rect.bottom && containmentRect.left < rect.left && containmentRect.right > rect.right && containmentRect.top < rect.top;
|
|
566
|
+
|
|
567
|
+
case 'right':
|
|
568
|
+
return containmentRect.right - offsetVal > rect.right && containmentRect.left < rect.left && containmentRect.top < rect.top && containmentRect.bottom > rect.bottom;
|
|
569
|
+
}
|
|
570
|
+
};
|
|
571
|
+
|
|
572
|
+
/***/ }),
|
|
573
|
+
/* 4 */
|
|
574
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
575
|
+
__webpack_require__.r(__webpack_exports__);
|
|
576
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return VisibilitySensor; });
|
|
577
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1);
|
|
578
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
579
|
+
/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2);
|
|
580
|
+
/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_dom__WEBPACK_IMPORTED_MODULE_1__);
|
|
581
|
+
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(0);
|
|
582
|
+
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_2__);
|
|
583
|
+
/* harmony import */ var _lib_is_visible_with_offset__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(3);
|
|
584
|
+
/* 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__);
|
|
585
|
+
|
|
586
|
+
|
|
587
|
+
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); }
|
|
588
|
+
|
|
589
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
590
|
+
|
|
591
|
+
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); } }
|
|
592
|
+
|
|
593
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
594
|
+
|
|
595
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
596
|
+
|
|
597
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
598
|
+
|
|
599
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
600
|
+
|
|
601
|
+
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); }
|
|
602
|
+
|
|
603
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
604
|
+
|
|
605
|
+
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; }
|
|
606
|
+
|
|
607
|
+
|
|
608
|
+
|
|
609
|
+
|
|
610
|
+
|
|
611
|
+
|
|
612
|
+
function normalizeRect(rect) {
|
|
613
|
+
if (rect.width === undefined) {
|
|
614
|
+
rect.width = rect.right - rect.left;
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
if (rect.height === undefined) {
|
|
618
|
+
rect.height = rect.bottom - rect.top;
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
return rect;
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
var VisibilitySensor =
|
|
625
|
+
/*#__PURE__*/
|
|
626
|
+
function (_React$Component) {
|
|
627
|
+
_inherits(VisibilitySensor, _React$Component);
|
|
628
|
+
|
|
629
|
+
function VisibilitySensor(props) {
|
|
630
|
+
var _this;
|
|
631
|
+
|
|
632
|
+
_classCallCheck(this, VisibilitySensor);
|
|
633
|
+
|
|
634
|
+
_this = _possibleConstructorReturn(this, _getPrototypeOf(VisibilitySensor).call(this, props));
|
|
635
|
+
|
|
636
|
+
_defineProperty(_assertThisInitialized(_this), "getContainer", function () {
|
|
637
|
+
return _this.props.containment || window;
|
|
638
|
+
});
|
|
639
|
+
|
|
640
|
+
_defineProperty(_assertThisInitialized(_this), "addEventListener", function (target, event, delay, throttle) {
|
|
641
|
+
if (!_this.debounceCheck) {
|
|
642
|
+
_this.debounceCheck = {};
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
var timeout;
|
|
646
|
+
var func;
|
|
647
|
+
|
|
648
|
+
var later = function later() {
|
|
649
|
+
timeout = null;
|
|
650
|
+
|
|
651
|
+
_this.check();
|
|
652
|
+
};
|
|
653
|
+
|
|
654
|
+
if (throttle > -1) {
|
|
655
|
+
func = function func() {
|
|
656
|
+
if (!timeout) {
|
|
657
|
+
timeout = setTimeout(later, throttle || 0);
|
|
658
|
+
}
|
|
659
|
+
};
|
|
660
|
+
} else {
|
|
661
|
+
func = function func() {
|
|
662
|
+
clearTimeout(timeout);
|
|
663
|
+
timeout = setTimeout(later, delay || 0);
|
|
664
|
+
};
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
var info = {
|
|
668
|
+
target: target,
|
|
669
|
+
fn: func,
|
|
670
|
+
getLastTimeout: function getLastTimeout() {
|
|
671
|
+
return timeout;
|
|
672
|
+
}
|
|
673
|
+
};
|
|
674
|
+
target.addEventListener(event, info.fn);
|
|
675
|
+
_this.debounceCheck[event] = info;
|
|
676
|
+
});
|
|
677
|
+
|
|
678
|
+
_defineProperty(_assertThisInitialized(_this), "startWatching", function () {
|
|
679
|
+
if (_this.debounceCheck || _this.interval) {
|
|
680
|
+
return;
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
if (_this.props.intervalCheck) {
|
|
684
|
+
_this.interval = setInterval(_this.check, _this.props.intervalDelay);
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
if (_this.props.scrollCheck) {
|
|
688
|
+
_this.addEventListener(_this.getContainer(), "scroll", _this.props.scrollDelay, _this.props.scrollThrottle);
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
if (_this.props.resizeCheck) {
|
|
692
|
+
_this.addEventListener(window, "resize", _this.props.resizeDelay, _this.props.resizeThrottle);
|
|
693
|
+
} // if dont need delayed call, check on load ( before the first interval fires )
|
|
694
|
+
|
|
695
|
+
|
|
696
|
+
!_this.props.delayedCall && _this.check();
|
|
697
|
+
});
|
|
698
|
+
|
|
699
|
+
_defineProperty(_assertThisInitialized(_this), "stopWatching", function () {
|
|
700
|
+
if (_this.debounceCheck) {
|
|
701
|
+
// clean up event listeners and their debounce callers
|
|
702
|
+
for (var debounceEvent in _this.debounceCheck) {
|
|
703
|
+
if (_this.debounceCheck.hasOwnProperty(debounceEvent)) {
|
|
704
|
+
var debounceInfo = _this.debounceCheck[debounceEvent];
|
|
705
|
+
clearTimeout(debounceInfo.getLastTimeout());
|
|
706
|
+
debounceInfo.target.removeEventListener(debounceEvent, debounceInfo.fn);
|
|
707
|
+
_this.debounceCheck[debounceEvent] = null;
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
_this.debounceCheck = null;
|
|
713
|
+
|
|
714
|
+
if (_this.interval) {
|
|
715
|
+
_this.interval = clearInterval(_this.interval);
|
|
716
|
+
}
|
|
717
|
+
});
|
|
718
|
+
|
|
719
|
+
_defineProperty(_assertThisInitialized(_this), "check", function () {
|
|
720
|
+
var el = _this.node;
|
|
721
|
+
var rect;
|
|
722
|
+
var containmentRect; // if the component has rendered to null, dont update visibility
|
|
723
|
+
|
|
724
|
+
if (!el) {
|
|
725
|
+
return _this.state;
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
rect = normalizeRect(_this.roundRectDown(el.getBoundingClientRect()));
|
|
729
|
+
|
|
730
|
+
if (_this.props.containment) {
|
|
731
|
+
var containmentDOMRect = _this.props.containment.getBoundingClientRect();
|
|
732
|
+
|
|
733
|
+
containmentRect = {
|
|
734
|
+
top: containmentDOMRect.top,
|
|
735
|
+
left: containmentDOMRect.left,
|
|
736
|
+
bottom: containmentDOMRect.bottom,
|
|
737
|
+
right: containmentDOMRect.right
|
|
738
|
+
};
|
|
739
|
+
} else {
|
|
740
|
+
containmentRect = {
|
|
741
|
+
top: 0,
|
|
742
|
+
left: 0,
|
|
743
|
+
bottom: window.innerHeight || document.documentElement.clientHeight,
|
|
744
|
+
right: window.innerWidth || document.documentElement.clientWidth
|
|
745
|
+
};
|
|
746
|
+
} // Check if visibility is wanted via offset?
|
|
747
|
+
|
|
748
|
+
|
|
749
|
+
var offset = _this.props.offset || {};
|
|
750
|
+
var hasValidOffset = _typeof(offset) === "object";
|
|
751
|
+
|
|
752
|
+
if (hasValidOffset) {
|
|
753
|
+
containmentRect.top += offset.top || 0;
|
|
754
|
+
containmentRect.left += offset.left || 0;
|
|
755
|
+
containmentRect.bottom -= offset.bottom || 0;
|
|
756
|
+
containmentRect.right -= offset.right || 0;
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
var visibilityRect = {
|
|
760
|
+
top: rect.top >= containmentRect.top,
|
|
761
|
+
left: rect.left >= containmentRect.left,
|
|
762
|
+
bottom: rect.bottom <= containmentRect.bottom,
|
|
763
|
+
right: rect.right <= containmentRect.right
|
|
764
|
+
}; // https://github.com/joshwnj/react-visibility-sensor/pull/114
|
|
765
|
+
|
|
766
|
+
var hasSize = rect.height > 0 && rect.width > 0;
|
|
767
|
+
var isVisible = hasSize && visibilityRect.top && visibilityRect.left && visibilityRect.bottom && visibilityRect.right; // check for partial visibility
|
|
768
|
+
|
|
769
|
+
if (hasSize && _this.props.partialVisibility) {
|
|
770
|
+
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
|
|
771
|
+
|
|
772
|
+
if (typeof _this.props.partialVisibility === "string") {
|
|
773
|
+
partialVisible = visibilityRect[_this.props.partialVisibility];
|
|
774
|
+
} // if we have minimum top visibility set by props, lets check, if it meets the passed value
|
|
775
|
+
// so if for instance element is at least 200px in viewport, then show it.
|
|
776
|
+
|
|
777
|
+
|
|
778
|
+
isVisible = _this.props.minTopValue ? partialVisible && rect.top <= containmentRect.bottom - _this.props.minTopValue : partialVisible;
|
|
779
|
+
} // Deprecated options for calculating offset.
|
|
780
|
+
|
|
781
|
+
|
|
782
|
+
if (typeof offset.direction === "string" && typeof offset.value === "number") {
|
|
783
|
+
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);
|
|
784
|
+
isVisible = _lib_is_visible_with_offset__WEBPACK_IMPORTED_MODULE_3___default()(offset, rect, containmentRect);
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
var state = _this.state; // notify the parent when the value changes
|
|
788
|
+
|
|
789
|
+
if (_this.state.isVisible !== isVisible) {
|
|
790
|
+
state = {
|
|
791
|
+
isVisible: isVisible,
|
|
792
|
+
visibilityRect: visibilityRect
|
|
793
|
+
};
|
|
794
|
+
|
|
795
|
+
_this.setState(state);
|
|
796
|
+
|
|
797
|
+
if (_this.props.onChange) _this.props.onChange(isVisible);
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
return state;
|
|
801
|
+
});
|
|
802
|
+
|
|
803
|
+
_this.state = {
|
|
804
|
+
isVisible: null,
|
|
805
|
+
visibilityRect: {}
|
|
806
|
+
};
|
|
807
|
+
return _this;
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
_createClass(VisibilitySensor, [{
|
|
811
|
+
key: "componentDidMount",
|
|
812
|
+
value: function componentDidMount() {
|
|
813
|
+
this.node = react_dom__WEBPACK_IMPORTED_MODULE_1___default.a.findDOMNode(this);
|
|
814
|
+
|
|
815
|
+
if (this.props.active) {
|
|
816
|
+
this.startWatching();
|
|
817
|
+
}
|
|
818
|
+
}
|
|
819
|
+
}, {
|
|
820
|
+
key: "componentWillUnmount",
|
|
821
|
+
value: function componentWillUnmount() {
|
|
822
|
+
this.stopWatching();
|
|
823
|
+
}
|
|
824
|
+
}, {
|
|
825
|
+
key: "componentDidUpdate",
|
|
826
|
+
value: function componentDidUpdate(prevProps) {
|
|
827
|
+
// re-register node in componentDidUpdate if children diffs [#103]
|
|
828
|
+
this.node = react_dom__WEBPACK_IMPORTED_MODULE_1___default.a.findDOMNode(this);
|
|
829
|
+
|
|
830
|
+
if (this.props.active && !prevProps.active) {
|
|
831
|
+
this.setState({
|
|
832
|
+
isVisible: null,
|
|
833
|
+
visibilityRect: {}
|
|
834
|
+
});
|
|
835
|
+
this.startWatching();
|
|
836
|
+
} else if (!this.props.active) {
|
|
837
|
+
this.stopWatching();
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
}, {
|
|
841
|
+
key: "roundRectDown",
|
|
842
|
+
value: function roundRectDown(rect) {
|
|
843
|
+
return {
|
|
844
|
+
top: Math.floor(rect.top),
|
|
845
|
+
left: Math.floor(rect.left),
|
|
846
|
+
bottom: Math.floor(rect.bottom),
|
|
847
|
+
right: Math.floor(rect.right)
|
|
848
|
+
};
|
|
849
|
+
}
|
|
850
|
+
/**
|
|
851
|
+
* Check if the element is within the visible viewport
|
|
852
|
+
*/
|
|
853
|
+
|
|
854
|
+
}, {
|
|
855
|
+
key: "render",
|
|
856
|
+
value: function render() {
|
|
857
|
+
if (this.props.children instanceof Function) {
|
|
858
|
+
return this.props.children({
|
|
859
|
+
isVisible: this.state.isVisible,
|
|
860
|
+
visibilityRect: this.state.visibilityRect
|
|
861
|
+
});
|
|
862
|
+
}
|
|
863
|
+
|
|
864
|
+
return react__WEBPACK_IMPORTED_MODULE_0___default.a.Children.only(this.props.children);
|
|
865
|
+
}
|
|
866
|
+
}]);
|
|
867
|
+
|
|
868
|
+
return VisibilitySensor;
|
|
869
|
+
}(react__WEBPACK_IMPORTED_MODULE_0___default.a.Component);
|
|
870
|
+
|
|
871
|
+
_defineProperty(VisibilitySensor, "defaultProps", {
|
|
872
|
+
active: true,
|
|
873
|
+
partialVisibility: false,
|
|
874
|
+
minTopValue: 0,
|
|
875
|
+
scrollCheck: false,
|
|
876
|
+
scrollDelay: 250,
|
|
877
|
+
scrollThrottle: -1,
|
|
878
|
+
resizeCheck: false,
|
|
879
|
+
resizeDelay: 250,
|
|
880
|
+
resizeThrottle: -1,
|
|
881
|
+
intervalCheck: true,
|
|
882
|
+
intervalDelay: 100,
|
|
883
|
+
delayedCall: false,
|
|
884
|
+
offset: {},
|
|
885
|
+
containment: null,
|
|
886
|
+
children: react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("span", null)
|
|
887
|
+
});
|
|
888
|
+
|
|
889
|
+
_defineProperty(VisibilitySensor, "propTypes", {
|
|
890
|
+
onChange: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.func,
|
|
891
|
+
active: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.bool,
|
|
892
|
+
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"])]),
|
|
893
|
+
delayedCall: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.bool,
|
|
894
|
+
offset: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.oneOfType([prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.shape({
|
|
895
|
+
top: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
|
|
896
|
+
left: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
|
|
897
|
+
bottom: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
|
|
898
|
+
right: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number
|
|
899
|
+
}), // deprecated offset property
|
|
900
|
+
prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.shape({
|
|
901
|
+
direction: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.oneOf(["top", "right", "bottom", "left"]),
|
|
902
|
+
value: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number
|
|
903
|
+
})]),
|
|
904
|
+
scrollCheck: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.bool,
|
|
905
|
+
scrollDelay: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
|
|
906
|
+
scrollThrottle: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
|
|
907
|
+
resizeCheck: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.bool,
|
|
908
|
+
resizeDelay: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
|
|
909
|
+
resizeThrottle: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
|
|
910
|
+
intervalCheck: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.bool,
|
|
911
|
+
intervalDelay: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
|
|
912
|
+
containment: typeof window !== "undefined" ? prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.instanceOf(window.Element) : prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.any,
|
|
913
|
+
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]),
|
|
914
|
+
minTopValue: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number
|
|
915
|
+
});
|
|
916
|
+
|
|
917
|
+
|
|
918
|
+
|
|
919
|
+
/***/ }),
|
|
920
|
+
/* 5 */
|
|
921
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
922
|
+
/**
|
|
923
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
924
|
+
*
|
|
925
|
+
* This source code is licensed under the MIT license found in the
|
|
926
|
+
* LICENSE file in the root directory of this source tree.
|
|
927
|
+
*/
|
|
928
|
+
|
|
929
|
+
|
|
930
|
+
|
|
931
|
+
var ReactPropTypesSecret = __webpack_require__(6);
|
|
932
|
+
|
|
933
|
+
function emptyFunction() {}
|
|
934
|
+
function emptyFunctionWithReset() {}
|
|
935
|
+
emptyFunctionWithReset.resetWarningCache = emptyFunction;
|
|
936
|
+
|
|
937
|
+
module.exports = function() {
|
|
938
|
+
function shim(props, propName, componentName, location, propFullName, secret) {
|
|
939
|
+
if (secret === ReactPropTypesSecret) {
|
|
940
|
+
// It is still safe when called from React.
|
|
941
|
+
return;
|
|
942
|
+
}
|
|
943
|
+
var err = new Error(
|
|
944
|
+
'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
|
|
945
|
+
'Use PropTypes.checkPropTypes() to call them. ' +
|
|
946
|
+
'Read more at http://fb.me/use-check-prop-types'
|
|
947
|
+
);
|
|
948
|
+
err.name = 'Invariant Violation';
|
|
949
|
+
throw err;
|
|
950
|
+
} shim.isRequired = shim;
|
|
951
|
+
function getShim() {
|
|
952
|
+
return shim;
|
|
953
|
+
} // Important!
|
|
954
|
+
// Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
|
|
955
|
+
var ReactPropTypes = {
|
|
956
|
+
array: shim,
|
|
957
|
+
bool: shim,
|
|
958
|
+
func: shim,
|
|
959
|
+
number: shim,
|
|
960
|
+
object: shim,
|
|
961
|
+
string: shim,
|
|
962
|
+
symbol: shim,
|
|
963
|
+
|
|
964
|
+
any: shim,
|
|
965
|
+
arrayOf: getShim,
|
|
966
|
+
element: shim,
|
|
967
|
+
elementType: shim,
|
|
968
|
+
instanceOf: getShim,
|
|
969
|
+
node: shim,
|
|
970
|
+
objectOf: getShim,
|
|
971
|
+
oneOf: getShim,
|
|
972
|
+
oneOfType: getShim,
|
|
973
|
+
shape: getShim,
|
|
974
|
+
exact: getShim,
|
|
975
|
+
|
|
976
|
+
checkPropTypes: emptyFunctionWithReset,
|
|
977
|
+
resetWarningCache: emptyFunction
|
|
978
|
+
};
|
|
979
|
+
|
|
980
|
+
ReactPropTypes.PropTypes = ReactPropTypes;
|
|
981
|
+
|
|
982
|
+
return ReactPropTypes;
|
|
983
|
+
};
|
|
984
|
+
|
|
985
|
+
|
|
986
|
+
/***/ }),
|
|
987
|
+
/* 6 */
|
|
988
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
989
|
+
/**
|
|
990
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
991
|
+
*
|
|
992
|
+
* This source code is licensed under the MIT license found in the
|
|
993
|
+
* LICENSE file in the root directory of this source tree.
|
|
994
|
+
*/
|
|
995
|
+
|
|
996
|
+
|
|
997
|
+
|
|
998
|
+
var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
|
|
999
|
+
|
|
1000
|
+
module.exports = ReactPropTypesSecret;
|
|
1001
|
+
|
|
1002
|
+
|
|
1003
|
+
/***/ })
|
|
1004
|
+
/******/ ]);
|
|
1005
|
+
});
|
|
1006
|
+
});
|
|
1007
|
+
|
|
1008
|
+
var VisibilitySensor = unwrapExports(visibilitySensor);
|
|
1009
|
+
|
|
1010
|
+
export { InfiniteScroll as I, VisibilitySensor as V };
|