@mjhls/mjh-framework 1.0.402 → 1.0.403
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-d1783f42.js → ADInfeed-494f5e6b.js} +1 -1
- package/dist/cjs/{AdSlot-20aa927e.js → AdSlot-4d22aad4.js} +2 -2
- package/dist/cjs/DeckContent.js +9 -7
- package/dist/cjs/DeckQueue.js +6 -4
- package/dist/cjs/{Dfp-27b922b0.js → Dfp-2399639f.js} +1 -1
- package/dist/cjs/{Figure-8dd7df44.js → Figure-04d4a60d.js} +1 -1
- package/dist/cjs/{GridContent-c0c0d3e5.js → GridContent-2f42692a.js} +7 -6
- package/dist/cjs/GridContent.js +9 -7
- package/dist/cjs/IssueDeck.js +182 -86
- package/dist/cjs/MasterDeck.js +21 -7
- package/dist/cjs/{Normal-c1c98dcf.js → Normal-4a0d7dfc.js} +82 -2
- package/dist/cjs/QueueDeckExpanded.js +9 -7
- package/dist/cjs/TemplateNormal.js +5 -4
- package/dist/cjs/VideoSeriesListing.js +3 -2
- package/dist/cjs/_iter-detect-234453c3.js +53 -0
- package/dist/cjs/index.es-ab3f2690.js +428 -0
- package/dist/cjs/index.js +19 -97
- package/dist/cjs/{main-2020ba94.js → main-bc4db521.js} +0 -50
- package/dist/cjs/{promise-d5136080.js → promise-0a493c7a.js} +4 -4
- package/dist/cjs/{toConsumableArray-3cf1df2c.js → toConsumableArray-25d0e2a3.js} +4 -4
- package/dist/cjs/{visibility-sensor-43e0b37c.js → visibility-sensor-0c45a583.js} +0 -421
- package/dist/esm/{ADInfeed-40adc8e0.js → ADInfeed-e5cefea5.js} +1 -1
- package/dist/esm/{AdSlot-c3ed3214.js → AdSlot-78e48a2c.js} +2 -2
- package/dist/esm/DeckContent.js +8 -6
- package/dist/esm/DeckQueue.js +5 -3
- package/dist/esm/{Dfp-3b3273ee.js → Dfp-d5fe1252.js} +1 -1
- package/dist/esm/{Figure-f269f495.js → Figure-e32f60c5.js} +1 -1
- package/dist/esm/{GridContent-b042eb2d.js → GridContent-cafb2fe4.js} +6 -5
- package/dist/esm/GridContent.js +9 -7
- package/dist/esm/IssueDeck.js +183 -87
- package/dist/esm/MasterDeck.js +20 -6
- package/dist/esm/{Normal-68ef59cd.js → Normal-b8c423e3.js} +82 -3
- package/dist/esm/QueueDeckExpanded.js +8 -6
- package/dist/esm/TemplateNormal.js +5 -4
- package/dist/esm/VideoSeriesListing.js +2 -1
- package/dist/esm/_iter-detect-7c281f0a.js +49 -0
- package/dist/esm/index.es-938a3a58.js +423 -0
- package/dist/esm/index.js +16 -94
- package/dist/esm/{main-25bb2c75.js → main-7d1b3c98.js} +1 -48
- package/dist/esm/{promise-5d7cd78a.js → promise-2592a80a.js} +1 -1
- package/dist/esm/{toConsumableArray-d7054876.js → toConsumableArray-c5e2fde8.js} +1 -1
- package/dist/esm/{visibility-sensor-49d5805d.js → visibility-sensor-0baa4eea.js} +2 -422
- package/package.json +1 -1
|
@@ -1,53 +1,6 @@
|
|
|
1
1
|
import { c as createCommonjsModule, a as commonjsGlobal, u as unwrapExports } from './_commonjsHelpers-0c4b6f40.js';
|
|
2
|
-
import { n as _anObject } from './_to-object-1b1f7766.js';
|
|
3
|
-
import { c as _wks, h as _iterators } from './web.dom.iterable-e6bf2bf6.js';
|
|
4
2
|
import React__default from 'react';
|
|
5
3
|
|
|
6
|
-
// call something on iterator step with safe closing on error
|
|
7
|
-
|
|
8
|
-
var _iterCall = function (iterator, fn, value, entries) {
|
|
9
|
-
try {
|
|
10
|
-
return entries ? fn(_anObject(value)[0], value[1]) : fn(value);
|
|
11
|
-
// 7.4.6 IteratorClose(iterator, completion)
|
|
12
|
-
} catch (e) {
|
|
13
|
-
var ret = iterator['return'];
|
|
14
|
-
if (ret !== undefined) _anObject(ret.call(iterator));
|
|
15
|
-
throw e;
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
// check on default Array iterator
|
|
20
|
-
|
|
21
|
-
var ITERATOR = _wks('iterator');
|
|
22
|
-
var ArrayProto = Array.prototype;
|
|
23
|
-
|
|
24
|
-
var _isArrayIter = function (it) {
|
|
25
|
-
return it !== undefined && (_iterators.Array === it || ArrayProto[ITERATOR] === it);
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
var ITERATOR$1 = _wks('iterator');
|
|
29
|
-
var SAFE_CLOSING = false;
|
|
30
|
-
|
|
31
|
-
try {
|
|
32
|
-
var riter = [7][ITERATOR$1]();
|
|
33
|
-
riter['return'] = function () { SAFE_CLOSING = true; };
|
|
34
|
-
// eslint-disable-next-line no-throw-literal
|
|
35
|
-
Array.from(riter, function () { throw 2; });
|
|
36
|
-
} catch (e) { /* empty */ }
|
|
37
|
-
|
|
38
|
-
var _iterDetect = function (exec, skipClosing) {
|
|
39
|
-
if (!skipClosing && !SAFE_CLOSING) return false;
|
|
40
|
-
var safe = false;
|
|
41
|
-
try {
|
|
42
|
-
var arr = [7];
|
|
43
|
-
var iter = arr[ITERATOR$1]();
|
|
44
|
-
iter.next = function () { return { done: safe = true }; };
|
|
45
|
-
arr[ITERATOR$1] = function () { return iter; };
|
|
46
|
-
exec(arr);
|
|
47
|
-
} catch (e) { /* empty */ }
|
|
48
|
-
return safe;
|
|
49
|
-
};
|
|
50
|
-
|
|
51
4
|
var uaParser_min = createCommonjsModule(function (module, exports) {
|
|
52
5
|
/*!
|
|
53
6
|
* UAParser.js v0.7.21
|
|
@@ -926,4 +879,4 @@ var main_51 = main.osName;
|
|
|
926
879
|
var main_52 = main.osVersion;
|
|
927
880
|
var main_53 = main.withOrientationChange;
|
|
928
881
|
|
|
929
|
-
export {
|
|
882
|
+
export { main_16 as a, main_38 as b, main_40 as c, main_39 as m };
|
|
@@ -2,7 +2,7 @@ import { c as createCommonjsModule, u as unwrapExports } from './_commonjsHelper
|
|
|
2
2
|
import { d as _ctx, h as _toLength, n as _anObject, m as _aFunction, i as _global, r as _cof, y as _domCreate, c as _isObject, k as _hide, b as _core, e as _descriptors, f as _objectDp, l as _export } from './_to-object-1b1f7766.js';
|
|
3
3
|
import { g as core_getIteratorMethod, c as _wks, j as _html, e as _classof, d as _setToStringTag } from './web.dom.iterable-e6bf2bf6.js';
|
|
4
4
|
import { _ as _library } from './_library-528f1934.js';
|
|
5
|
-
import {
|
|
5
|
+
import { a as _isArrayIter, b as _iterCall, _ as _iterDetect } from './_iter-detect-7c281f0a.js';
|
|
6
6
|
|
|
7
7
|
var _anInstance = function (it, Constructor, name, forbiddenField) {
|
|
8
8
|
if (!(it instanceof Constructor) || (forbiddenField !== undefined && forbiddenField in it)) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { c as createCommonjsModule, u as unwrapExports } from './_commonjsHelpers-0c4b6f40.js';
|
|
2
2
|
import { f as _objectDp, o as _propertyDesc, l as _export, a as _toObject, d as _ctx, h as _toLength, b as _core } from './_to-object-1b1f7766.js';
|
|
3
3
|
import { g as core_getIteratorMethod } from './web.dom.iterable-e6bf2bf6.js';
|
|
4
|
-
import { _ as _iterDetect,
|
|
4
|
+
import { _ as _iterDetect, a as _isArrayIter, b as _iterCall } from './_iter-detect-7c281f0a.js';
|
|
5
5
|
|
|
6
6
|
var _createProperty = function (object, index, value) {
|
|
7
7
|
if (index in object) _objectDp.f(object, index, _propertyDesc(0, value));
|
|
@@ -1,427 +1,7 @@
|
|
|
1
1
|
import { c as createCommonjsModule, a as commonjsGlobal, u as unwrapExports } from './_commonjsHelpers-0c4b6f40.js';
|
|
2
|
-
import React__default
|
|
2
|
+
import React__default from 'react';
|
|
3
3
|
import reactDom from 'react-dom';
|
|
4
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
5
|
var visibilitySensor = createCommonjsModule(function (module, exports) {
|
|
426
6
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
427
7
|
module.exports = factory(React__default, reactDom);
|
|
@@ -1007,4 +587,4 @@ module.exports = ReactPropTypesSecret;
|
|
|
1007
587
|
|
|
1008
588
|
var VisibilitySensor = unwrapExports(visibilitySensor);
|
|
1009
589
|
|
|
1010
|
-
export {
|
|
590
|
+
export { VisibilitySensor as V };
|