@mjhls/mjh-framework 1.0.402 → 1.0.404
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-9e886c5b.js} +2 -4
- 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 +23 -100
- 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-cc1affbe.js} +2 -4
- 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 +20 -97
- 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
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { n as _anObject } from './_to-object-1b1f7766.js';
|
|
2
|
+
import { c as _wks, h as _iterators } from './web.dom.iterable-e6bf2bf6.js';
|
|
3
|
+
|
|
4
|
+
// call something on iterator step with safe closing on error
|
|
5
|
+
|
|
6
|
+
var _iterCall = function (iterator, fn, value, entries) {
|
|
7
|
+
try {
|
|
8
|
+
return entries ? fn(_anObject(value)[0], value[1]) : fn(value);
|
|
9
|
+
// 7.4.6 IteratorClose(iterator, completion)
|
|
10
|
+
} catch (e) {
|
|
11
|
+
var ret = iterator['return'];
|
|
12
|
+
if (ret !== undefined) _anObject(ret.call(iterator));
|
|
13
|
+
throw e;
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
// check on default Array iterator
|
|
18
|
+
|
|
19
|
+
var ITERATOR = _wks('iterator');
|
|
20
|
+
var ArrayProto = Array.prototype;
|
|
21
|
+
|
|
22
|
+
var _isArrayIter = function (it) {
|
|
23
|
+
return it !== undefined && (_iterators.Array === it || ArrayProto[ITERATOR] === it);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
var ITERATOR$1 = _wks('iterator');
|
|
27
|
+
var SAFE_CLOSING = false;
|
|
28
|
+
|
|
29
|
+
try {
|
|
30
|
+
var riter = [7][ITERATOR$1]();
|
|
31
|
+
riter['return'] = function () { SAFE_CLOSING = true; };
|
|
32
|
+
// eslint-disable-next-line no-throw-literal
|
|
33
|
+
Array.from(riter, function () { throw 2; });
|
|
34
|
+
} catch (e) { /* empty */ }
|
|
35
|
+
|
|
36
|
+
var _iterDetect = function (exec, skipClosing) {
|
|
37
|
+
if (!skipClosing && !SAFE_CLOSING) return false;
|
|
38
|
+
var safe = false;
|
|
39
|
+
try {
|
|
40
|
+
var arr = [7];
|
|
41
|
+
var iter = arr[ITERATOR$1]();
|
|
42
|
+
iter.next = function () { return { done: safe = true }; };
|
|
43
|
+
arr[ITERATOR$1] = function () { return iter; };
|
|
44
|
+
exec(arr);
|
|
45
|
+
} catch (e) { /* empty */ }
|
|
46
|
+
return safe;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export { _iterDetect as _, _isArrayIter as a, _iterCall as b };
|
|
@@ -0,0 +1,423 @@
|
|
|
1
|
+
import React__default, { Component } from 'react';
|
|
2
|
+
|
|
3
|
+
/*! *****************************************************************************
|
|
4
|
+
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
6
|
+
this file except in compliance with the License. You may obtain a copy of the
|
|
7
|
+
License at http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
|
|
9
|
+
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
10
|
+
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
|
11
|
+
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
|
12
|
+
MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
13
|
+
|
|
14
|
+
See the Apache Version 2.0 License for specific language governing permissions
|
|
15
|
+
and limitations under the License.
|
|
16
|
+
***************************************************************************** */
|
|
17
|
+
/* global Reflect, Promise */
|
|
18
|
+
|
|
19
|
+
var extendStatics = function(d, b) {
|
|
20
|
+
extendStatics = Object.setPrototypeOf ||
|
|
21
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
22
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
23
|
+
return extendStatics(d, b);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
function __extends(d, b) {
|
|
27
|
+
extendStatics(d, b);
|
|
28
|
+
function __() { this.constructor = d; }
|
|
29
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
var __assign = function() {
|
|
33
|
+
__assign = Object.assign || function __assign(t) {
|
|
34
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
35
|
+
s = arguments[i];
|
|
36
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
37
|
+
}
|
|
38
|
+
return t;
|
|
39
|
+
};
|
|
40
|
+
return __assign.apply(this, arguments);
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
/* eslint-disable no-undefined,no-param-reassign,no-shadow */
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Throttle execution of a function. Especially useful for rate limiting
|
|
47
|
+
* execution of handlers on events like resize and scroll.
|
|
48
|
+
*
|
|
49
|
+
* @param {Number} delay A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful.
|
|
50
|
+
* @param {Boolean} [noTrailing] Optional, defaults to false. If noTrailing is true, callback will only execute every `delay` milliseconds while the
|
|
51
|
+
* throttled-function is being called. If noTrailing is false or unspecified, callback will be executed one final time
|
|
52
|
+
* after the last throttled-function call. (After the throttled-function has not been called for `delay` milliseconds,
|
|
53
|
+
* the internal counter is reset)
|
|
54
|
+
* @param {Function} callback A function to be executed after delay milliseconds. The `this` context and all arguments are passed through, as-is,
|
|
55
|
+
* to `callback` when the throttled-function is executed.
|
|
56
|
+
* @param {Boolean} [debounceMode] If `debounceMode` is true (at begin), schedule `clear` to execute after `delay` ms. If `debounceMode` is false (at end),
|
|
57
|
+
* schedule `callback` to execute after `delay` ms.
|
|
58
|
+
*
|
|
59
|
+
* @return {Function} A new, throttled, function.
|
|
60
|
+
*/
|
|
61
|
+
function throttle (delay, noTrailing, callback, debounceMode) {
|
|
62
|
+
/*
|
|
63
|
+
* After wrapper has stopped being called, this timeout ensures that
|
|
64
|
+
* `callback` is executed at the proper times in `throttle` and `end`
|
|
65
|
+
* debounce modes.
|
|
66
|
+
*/
|
|
67
|
+
var timeoutID;
|
|
68
|
+
var cancelled = false; // Keep track of the last time `callback` was executed.
|
|
69
|
+
|
|
70
|
+
var lastExec = 0; // Function to clear existing timeout
|
|
71
|
+
|
|
72
|
+
function clearExistingTimeout() {
|
|
73
|
+
if (timeoutID) {
|
|
74
|
+
clearTimeout(timeoutID);
|
|
75
|
+
}
|
|
76
|
+
} // Function to cancel next exec
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
function cancel() {
|
|
80
|
+
clearExistingTimeout();
|
|
81
|
+
cancelled = true;
|
|
82
|
+
} // `noTrailing` defaults to falsy.
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
if (typeof noTrailing !== 'boolean') {
|
|
86
|
+
debounceMode = callback;
|
|
87
|
+
callback = noTrailing;
|
|
88
|
+
noTrailing = undefined;
|
|
89
|
+
}
|
|
90
|
+
/*
|
|
91
|
+
* The `wrapper` function encapsulates all of the throttling / debouncing
|
|
92
|
+
* functionality and when executed will limit the rate at which `callback`
|
|
93
|
+
* is executed.
|
|
94
|
+
*/
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
function wrapper() {
|
|
98
|
+
var self = this;
|
|
99
|
+
var elapsed = Date.now() - lastExec;
|
|
100
|
+
var args = arguments;
|
|
101
|
+
|
|
102
|
+
if (cancelled) {
|
|
103
|
+
return;
|
|
104
|
+
} // Execute `callback` and update the `lastExec` timestamp.
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
function exec() {
|
|
108
|
+
lastExec = Date.now();
|
|
109
|
+
callback.apply(self, args);
|
|
110
|
+
}
|
|
111
|
+
/*
|
|
112
|
+
* If `debounceMode` is true (at begin) this is used to clear the flag
|
|
113
|
+
* to allow future `callback` executions.
|
|
114
|
+
*/
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
function clear() {
|
|
118
|
+
timeoutID = undefined;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
if (debounceMode && !timeoutID) {
|
|
122
|
+
/*
|
|
123
|
+
* Since `wrapper` is being called for the first time and
|
|
124
|
+
* `debounceMode` is true (at begin), execute `callback`.
|
|
125
|
+
*/
|
|
126
|
+
exec();
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
clearExistingTimeout();
|
|
130
|
+
|
|
131
|
+
if (debounceMode === undefined && elapsed > delay) {
|
|
132
|
+
/*
|
|
133
|
+
* In throttle mode, if `delay` time has been exceeded, execute
|
|
134
|
+
* `callback`.
|
|
135
|
+
*/
|
|
136
|
+
exec();
|
|
137
|
+
} else if (noTrailing !== true) {
|
|
138
|
+
/*
|
|
139
|
+
* In trailing throttle mode, since `delay` time has not been
|
|
140
|
+
* exceeded, schedule `callback` to execute `delay` ms after most
|
|
141
|
+
* recent execution.
|
|
142
|
+
*
|
|
143
|
+
* If `debounceMode` is true (at begin), schedule `clear` to execute
|
|
144
|
+
* after `delay` ms.
|
|
145
|
+
*
|
|
146
|
+
* If `debounceMode` is false (at end), schedule `callback` to
|
|
147
|
+
* execute after `delay` ms.
|
|
148
|
+
*/
|
|
149
|
+
timeoutID = setTimeout(debounceMode ? clear : exec, debounceMode === undefined ? delay - elapsed : delay);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
wrapper.cancel = cancel; // Return the wrapper function.
|
|
154
|
+
|
|
155
|
+
return wrapper;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
var ThresholdUnits = {
|
|
159
|
+
Pixel: 'Pixel',
|
|
160
|
+
Percent: 'Percent',
|
|
161
|
+
};
|
|
162
|
+
var defaultThreshold = {
|
|
163
|
+
unit: ThresholdUnits.Percent,
|
|
164
|
+
value: 0.8,
|
|
165
|
+
};
|
|
166
|
+
function parseThreshold(scrollThreshold) {
|
|
167
|
+
if (typeof scrollThreshold === 'number') {
|
|
168
|
+
return {
|
|
169
|
+
unit: ThresholdUnits.Percent,
|
|
170
|
+
value: scrollThreshold * 100,
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
if (typeof scrollThreshold === 'string') {
|
|
174
|
+
if (scrollThreshold.match(/^(\d*(\.\d+)?)px$/)) {
|
|
175
|
+
return {
|
|
176
|
+
unit: ThresholdUnits.Pixel,
|
|
177
|
+
value: parseFloat(scrollThreshold),
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
if (scrollThreshold.match(/^(\d*(\.\d+)?)%$/)) {
|
|
181
|
+
return {
|
|
182
|
+
unit: ThresholdUnits.Percent,
|
|
183
|
+
value: parseFloat(scrollThreshold),
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
console.warn('scrollThreshold format is invalid. Valid formats: "120px", "50%"...');
|
|
187
|
+
return defaultThreshold;
|
|
188
|
+
}
|
|
189
|
+
console.warn('scrollThreshold should be string or number');
|
|
190
|
+
return defaultThreshold;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
var InfiniteScroll = /** @class */ (function (_super) {
|
|
194
|
+
__extends(InfiniteScroll, _super);
|
|
195
|
+
function InfiniteScroll(props) {
|
|
196
|
+
var _this = _super.call(this, props) || this;
|
|
197
|
+
_this.lastScrollTop = 0;
|
|
198
|
+
_this.actionTriggered = false;
|
|
199
|
+
// variables to keep track of pull down behaviour
|
|
200
|
+
_this.startY = 0;
|
|
201
|
+
_this.currentY = 0;
|
|
202
|
+
_this.dragging = false;
|
|
203
|
+
// will be populated in componentDidMount
|
|
204
|
+
// based on the height of the pull down element
|
|
205
|
+
_this.maxPullDownDistance = 0;
|
|
206
|
+
_this.getScrollableTarget = function () {
|
|
207
|
+
if (_this.props.scrollableTarget instanceof HTMLElement)
|
|
208
|
+
return _this.props.scrollableTarget;
|
|
209
|
+
if (typeof _this.props.scrollableTarget === 'string') {
|
|
210
|
+
return document.getElementById(_this.props.scrollableTarget);
|
|
211
|
+
}
|
|
212
|
+
if (_this.props.scrollableTarget === null) {
|
|
213
|
+
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 ");
|
|
214
|
+
}
|
|
215
|
+
return null;
|
|
216
|
+
};
|
|
217
|
+
_this.onStart = function (evt) {
|
|
218
|
+
if (_this.lastScrollTop)
|
|
219
|
+
return;
|
|
220
|
+
_this.dragging = true;
|
|
221
|
+
if (evt instanceof MouseEvent) {
|
|
222
|
+
_this.startY = evt.pageY;
|
|
223
|
+
}
|
|
224
|
+
else if (evt instanceof TouchEvent) {
|
|
225
|
+
_this.startY = evt.touches[0].pageY;
|
|
226
|
+
}
|
|
227
|
+
_this.currentY = _this.startY;
|
|
228
|
+
if (_this._infScroll) {
|
|
229
|
+
_this._infScroll.style.willChange = 'transform';
|
|
230
|
+
_this._infScroll.style.transition = "transform 0.2s cubic-bezier(0,0,0.31,1)";
|
|
231
|
+
}
|
|
232
|
+
};
|
|
233
|
+
_this.onMove = function (evt) {
|
|
234
|
+
if (!_this.dragging)
|
|
235
|
+
return;
|
|
236
|
+
if (evt instanceof MouseEvent) {
|
|
237
|
+
_this.currentY = evt.pageY;
|
|
238
|
+
}
|
|
239
|
+
else if (evt instanceof TouchEvent) {
|
|
240
|
+
_this.currentY = evt.touches[0].pageY;
|
|
241
|
+
}
|
|
242
|
+
// user is scrolling down to up
|
|
243
|
+
if (_this.currentY < _this.startY)
|
|
244
|
+
return;
|
|
245
|
+
if (_this.currentY - _this.startY >=
|
|
246
|
+
Number(_this.props.pullDownToRefreshThreshold)) {
|
|
247
|
+
_this.setState({
|
|
248
|
+
pullToRefreshThresholdBreached: true,
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
// so you can drag upto 1.5 times of the maxPullDownDistance
|
|
252
|
+
if (_this.currentY - _this.startY > _this.maxPullDownDistance * 1.5)
|
|
253
|
+
return;
|
|
254
|
+
if (_this._infScroll) {
|
|
255
|
+
_this._infScroll.style.overflow = 'visible';
|
|
256
|
+
_this._infScroll.style.transform = "translate3d(0px, " + (_this.currentY -
|
|
257
|
+
_this.startY) + "px, 0px)";
|
|
258
|
+
}
|
|
259
|
+
};
|
|
260
|
+
_this.onEnd = function () {
|
|
261
|
+
_this.startY = 0;
|
|
262
|
+
_this.currentY = 0;
|
|
263
|
+
_this.dragging = false;
|
|
264
|
+
if (_this.state.pullToRefreshThresholdBreached) {
|
|
265
|
+
_this.props.refreshFunction && _this.props.refreshFunction();
|
|
266
|
+
_this.setState({
|
|
267
|
+
pullToRefreshThresholdBreached: false,
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
requestAnimationFrame(function () {
|
|
271
|
+
// this._infScroll
|
|
272
|
+
if (_this._infScroll) {
|
|
273
|
+
_this._infScroll.style.overflow = 'auto';
|
|
274
|
+
_this._infScroll.style.transform = 'none';
|
|
275
|
+
_this._infScroll.style.willChange = 'none';
|
|
276
|
+
}
|
|
277
|
+
});
|
|
278
|
+
};
|
|
279
|
+
_this.onScrollListener = function (event) {
|
|
280
|
+
if (typeof _this.props.onScroll === 'function') {
|
|
281
|
+
// Execute this callback in next tick so that it does not affect the
|
|
282
|
+
// functionality of the library.
|
|
283
|
+
setTimeout(function () { return _this.props.onScroll && _this.props.onScroll(event); }, 0);
|
|
284
|
+
}
|
|
285
|
+
var target = _this.props.height || _this._scrollableNode
|
|
286
|
+
? event.target
|
|
287
|
+
: document.documentElement.scrollTop
|
|
288
|
+
? document.documentElement
|
|
289
|
+
: document.body;
|
|
290
|
+
// return immediately if the action has already been triggered,
|
|
291
|
+
// prevents multiple triggers.
|
|
292
|
+
if (_this.actionTriggered)
|
|
293
|
+
return;
|
|
294
|
+
var atBottom = _this.isElementAtBottom(target, _this.props.scrollThreshold);
|
|
295
|
+
// call the `next` function in the props to trigger the next data fetch
|
|
296
|
+
if (atBottom && _this.props.hasMore) {
|
|
297
|
+
_this.actionTriggered = true;
|
|
298
|
+
_this.setState({ showLoader: true });
|
|
299
|
+
_this.props.next && _this.props.next();
|
|
300
|
+
}
|
|
301
|
+
_this.lastScrollTop = target.scrollTop;
|
|
302
|
+
};
|
|
303
|
+
_this.state = {
|
|
304
|
+
showLoader: false,
|
|
305
|
+
pullToRefreshThresholdBreached: false,
|
|
306
|
+
};
|
|
307
|
+
_this.throttledOnScrollListener = throttle(150, _this.onScrollListener).bind(_this);
|
|
308
|
+
_this.onStart = _this.onStart.bind(_this);
|
|
309
|
+
_this.onMove = _this.onMove.bind(_this);
|
|
310
|
+
_this.onEnd = _this.onEnd.bind(_this);
|
|
311
|
+
return _this;
|
|
312
|
+
}
|
|
313
|
+
InfiniteScroll.prototype.componentDidMount = function () {
|
|
314
|
+
if (typeof this.props.dataLength === 'undefined') {
|
|
315
|
+
throw new Error("mandatory prop \"dataLength\" is missing. The prop is needed" +
|
|
316
|
+
" when loading more content. Check README.md for usage");
|
|
317
|
+
}
|
|
318
|
+
this._scrollableNode = this.getScrollableTarget();
|
|
319
|
+
this.el = this.props.height
|
|
320
|
+
? this._infScroll
|
|
321
|
+
: this._scrollableNode || window;
|
|
322
|
+
if (this.el) {
|
|
323
|
+
this.el.addEventListener('scroll', this
|
|
324
|
+
.throttledOnScrollListener);
|
|
325
|
+
}
|
|
326
|
+
if (typeof this.props.initialScrollY === 'number' &&
|
|
327
|
+
this.el &&
|
|
328
|
+
this.el instanceof HTMLElement &&
|
|
329
|
+
this.el.scrollHeight > this.props.initialScrollY) {
|
|
330
|
+
this.el.scrollTo(0, this.props.initialScrollY);
|
|
331
|
+
}
|
|
332
|
+
if (this.props.pullDownToRefresh && this.el) {
|
|
333
|
+
this.el.addEventListener('touchstart', this.onStart);
|
|
334
|
+
this.el.addEventListener('touchmove', this.onMove);
|
|
335
|
+
this.el.addEventListener('touchend', this.onEnd);
|
|
336
|
+
this.el.addEventListener('mousedown', this.onStart);
|
|
337
|
+
this.el.addEventListener('mousemove', this.onMove);
|
|
338
|
+
this.el.addEventListener('mouseup', this.onEnd);
|
|
339
|
+
// get BCR of pullDown element to position it above
|
|
340
|
+
this.maxPullDownDistance =
|
|
341
|
+
(this._pullDown &&
|
|
342
|
+
this._pullDown.firstChild &&
|
|
343
|
+
this._pullDown.firstChild.getBoundingClientRect()
|
|
344
|
+
.height) ||
|
|
345
|
+
0;
|
|
346
|
+
this.forceUpdate();
|
|
347
|
+
if (typeof this.props.refreshFunction !== 'function') {
|
|
348
|
+
throw new Error("Mandatory prop \"refreshFunction\" missing.\n Pull Down To Refresh functionality will not work\n as expected. Check README.md for usage'");
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
};
|
|
352
|
+
InfiniteScroll.prototype.componentWillUnmount = function () {
|
|
353
|
+
if (this.el) {
|
|
354
|
+
this.el.removeEventListener('scroll', this
|
|
355
|
+
.throttledOnScrollListener);
|
|
356
|
+
if (this.props.pullDownToRefresh) {
|
|
357
|
+
this.el.removeEventListener('touchstart', this.onStart);
|
|
358
|
+
this.el.removeEventListener('touchmove', this.onMove);
|
|
359
|
+
this.el.removeEventListener('touchend', this.onEnd);
|
|
360
|
+
this.el.removeEventListener('mousedown', this.onStart);
|
|
361
|
+
this.el.removeEventListener('mousemove', this.onMove);
|
|
362
|
+
this.el.removeEventListener('mouseup', this.onEnd);
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
};
|
|
366
|
+
InfiniteScroll.prototype.UNSAFE_componentWillReceiveProps = function (props) {
|
|
367
|
+
// do nothing when dataLength and key are unchanged
|
|
368
|
+
if (this.props.key === props.key &&
|
|
369
|
+
this.props.dataLength === props.dataLength)
|
|
370
|
+
return;
|
|
371
|
+
this.actionTriggered = false;
|
|
372
|
+
// update state when new data was sent in
|
|
373
|
+
this.setState({
|
|
374
|
+
showLoader: false,
|
|
375
|
+
});
|
|
376
|
+
};
|
|
377
|
+
InfiniteScroll.prototype.isElementAtBottom = function (target, scrollThreshold) {
|
|
378
|
+
if (scrollThreshold === void 0) { scrollThreshold = 0.8; }
|
|
379
|
+
var clientHeight = target === document.body || target === document.documentElement
|
|
380
|
+
? window.screen.availHeight
|
|
381
|
+
: target.clientHeight;
|
|
382
|
+
var threshold = parseThreshold(scrollThreshold);
|
|
383
|
+
if (threshold.unit === ThresholdUnits.Pixel) {
|
|
384
|
+
return (target.scrollTop + clientHeight >= target.scrollHeight - threshold.value);
|
|
385
|
+
}
|
|
386
|
+
return (target.scrollTop + clientHeight >=
|
|
387
|
+
(threshold.value / 100) * target.scrollHeight);
|
|
388
|
+
};
|
|
389
|
+
InfiniteScroll.prototype.render = function () {
|
|
390
|
+
var _this = this;
|
|
391
|
+
var style = __assign({ height: this.props.height || 'auto', overflow: 'auto', WebkitOverflowScrolling: 'touch' }, this.props.style);
|
|
392
|
+
var hasChildren = this.props.hasChildren ||
|
|
393
|
+
!!(this.props.children &&
|
|
394
|
+
this.props.children instanceof Array &&
|
|
395
|
+
this.props.children.length);
|
|
396
|
+
// because heighted infiniteScroll visualy breaks
|
|
397
|
+
// on drag down as overflow becomes visible
|
|
398
|
+
var outerDivStyle = this.props.pullDownToRefresh && this.props.height
|
|
399
|
+
? { overflow: 'auto' }
|
|
400
|
+
: {};
|
|
401
|
+
return (React__default.createElement("div", { style: outerDivStyle, className: "infinite-scroll-component__outerdiv" },
|
|
402
|
+
React__default.createElement("div", { className: "infinite-scroll-component " + (this.props.className || ''), ref: function (infScroll) { return (_this._infScroll = infScroll); }, style: style },
|
|
403
|
+
this.props.pullDownToRefresh && (React__default.createElement("div", { style: { position: 'relative' }, ref: function (pullDown) { return (_this._pullDown = pullDown); } },
|
|
404
|
+
React__default.createElement("div", { style: {
|
|
405
|
+
position: 'absolute',
|
|
406
|
+
left: 0,
|
|
407
|
+
right: 0,
|
|
408
|
+
top: -1 * this.maxPullDownDistance,
|
|
409
|
+
} }, this.state.pullToRefreshThresholdBreached
|
|
410
|
+
? this.props.releaseToRefreshContent
|
|
411
|
+
: this.props.pullDownToRefreshContent))),
|
|
412
|
+
this.props.children,
|
|
413
|
+
!this.state.showLoader &&
|
|
414
|
+
!hasChildren &&
|
|
415
|
+
this.props.hasMore &&
|
|
416
|
+
this.props.loader,
|
|
417
|
+
this.state.showLoader && this.props.hasMore && this.props.loader,
|
|
418
|
+
!this.props.hasMore && this.props.endMessage)));
|
|
419
|
+
};
|
|
420
|
+
return InfiniteScroll;
|
|
421
|
+
}(Component));
|
|
422
|
+
|
|
423
|
+
export { InfiniteScroll as I };
|
package/dist/esm/index.js
CHANGED
|
@@ -2,8 +2,8 @@ import { c as createCommonjsModule, a as commonjsGlobal, g as getCjsExportFromNa
|
|
|
2
2
|
import { _ as _objectKeys, a as _toObject, b as _core, c as _isObject, d as _ctx, e as _descriptors, f as _objectDp, g as _iobject, h as _toLength, i as _global, j as _fails, k as _hide, l as _export, m as _aFunction } from './_to-object-1b1f7766.js';
|
|
3
3
|
import { _ as _objectCreate, a as _iterDefine, b as _iterStep, c as _wks, d as _setToStringTag, e as _classof } from './web.dom.iterable-e6bf2bf6.js';
|
|
4
4
|
import './_library-528f1934.js';
|
|
5
|
-
import
|
|
6
|
-
import { _ as _toConsumableArray, a as _Array$from } from './toConsumableArray-
|
|
5
|
+
import './_iter-detect-7c281f0a.js';
|
|
6
|
+
import { _ as _toConsumableArray, a as _Array$from } from './toConsumableArray-c5e2fde8.js';
|
|
7
7
|
import './_object-pie-33c40e79.js';
|
|
8
8
|
import { _ as _extends$2, a as _Object$assign } from './extends-92072fff.js';
|
|
9
9
|
import { _ as _objectSap, a as _inherits$1, b as _classCallCheck$1, c as _possibleConstructorReturn$1, d as _Object$getPrototypeOf, e as _createClass$1, f as defineProperty$2 } from './inherits-dfba24f5.js';
|
|
@@ -17,19 +17,21 @@ import Col from 'react-bootstrap/Col';
|
|
|
17
17
|
import Card from 'react-bootstrap/Card';
|
|
18
18
|
import { m as moment } from './moment-12415288.js';
|
|
19
19
|
import Router, { useRouter } from 'next/router';
|
|
20
|
-
import { I as InfiniteScroll
|
|
20
|
+
import { I as InfiniteScroll } from './index.es-938a3a58.js';
|
|
21
21
|
import 'react-dom';
|
|
22
|
+
import { V as VisibilitySensor } from './visibility-sensor-0baa4eea.js';
|
|
22
23
|
import { i as imageUrlBuilder } from './index-51a80699.js';
|
|
23
24
|
import { L as LazyLoad } from './index-5f9f807a.js';
|
|
25
|
+
import { m as main_39, a as main_16, b as main_38 } from './main-7d1b3c98.js';
|
|
24
26
|
import { c as clean_html_1, h as html_decode_1 } from './entities-7cc3bf45.js';
|
|
25
27
|
import { _ as _slicedToArray, a as _getIterator } from './slicedToArray-04e02710.js';
|
|
26
|
-
import { _ as _JSON$stringify, a as _asyncToGenerator, r as regenerator, D as DFPAdSlot, B as Beam } from './AdSlot-
|
|
27
|
-
export { D as AdSlot, B as Beam } from './AdSlot-
|
|
28
|
-
import { _ as _anInstance, a as _forOf, b as _redefineAll, c as _setSpecies } from './promise-
|
|
29
|
-
import { A as ADInfeed } from './ADInfeed-
|
|
28
|
+
import { _ as _JSON$stringify, a as _asyncToGenerator, r as regenerator, D as DFPAdSlot, B as Beam } from './AdSlot-78e48a2c.js';
|
|
29
|
+
export { D as AdSlot, B as Beam } from './AdSlot-78e48a2c.js';
|
|
30
|
+
import { _ as _anInstance, a as _forOf, b as _redefineAll, c as _setSpecies } from './promise-2592a80a.js';
|
|
31
|
+
import { A as ADInfeed } from './ADInfeed-e5cefea5.js';
|
|
30
32
|
export { default as DeckContent } from './DeckContent.js';
|
|
31
33
|
import { i as isFunction_1, a as isArray_1, _ as _arrayMap } from './get-53653403.js';
|
|
32
|
-
export { A as AD, G as GridContent } from './GridContent-
|
|
34
|
+
export { A as AD, G as GridContent } from './GridContent-cafb2fe4.js';
|
|
33
35
|
import { A as AuthorComponent } from './AuthorComponent-c9e46673.js';
|
|
34
36
|
export { default as DeckQueue } from './DeckQueue.js';
|
|
35
37
|
import 'react-bootstrap/Media';
|
|
@@ -52,8 +54,8 @@ export { default as IssueDeck } from './IssueDeck.js';
|
|
|
52
54
|
import 'react-bootstrap/Badge';
|
|
53
55
|
export { default as IssueContentDeck } from './IssueContentDeck.js';
|
|
54
56
|
import Spinner from 'react-bootstrap/Spinner';
|
|
55
|
-
import { M as MdPictureAsPdf } from './Normal-
|
|
56
|
-
export { A as AD728x90, C as Column1, a as Column2, b as Column3, f as HamMagazine, H as Header, L as LeftNav, e as NavDvm, c as NavMagazine, N as NavNative, d as NavNormal, P as PageFilter, S as Search,
|
|
57
|
+
import { M as MdPictureAsPdf } from './Normal-b8c423e3.js';
|
|
58
|
+
export { A as AD728x90, g as ADSponsoredResources, C as Column1, a as Column2, b as Column3, f as HamMagazine, H as Header, L as LeftNav, e as NavDvm, c as NavMagazine, N as NavNative, d as NavNormal, P as PageFilter, S as Search, h as SideFooter, T as TemplateNormal } from './Normal-b8c423e3.js';
|
|
57
59
|
import 'react-bootstrap/ListGroup';
|
|
58
60
|
import Head from 'next/head';
|
|
59
61
|
import Accordion from 'react-bootstrap/Accordion';
|
|
@@ -3507,9 +3509,7 @@ var ADFloatingFooter = function ADFloatingFooter(_ref) {
|
|
|
3507
3509
|
targeting = _floatingAd$targeting === undefined ? {} : _floatingAd$targeting,
|
|
3508
3510
|
_floatingAd$position = floatingAd.position,
|
|
3509
3511
|
position = _floatingAd$position === undefined ? 'float' : _floatingAd$position,
|
|
3510
|
-
networkID = floatingAd.networkID
|
|
3511
|
-
_floatingAd$sizes = floatingAd.sizes,
|
|
3512
|
-
sizes = _floatingAd$sizes === undefined ? [[1025, 100], [728, 90]] : _floatingAd$sizes;
|
|
3512
|
+
networkID = floatingAd.networkID;
|
|
3513
3513
|
|
|
3514
3514
|
var adTargeting = {
|
|
3515
3515
|
content_placement: targeting.content_placement,
|
|
@@ -3563,7 +3563,7 @@ var ADFloatingFooter = function ADFloatingFooter(_ref) {
|
|
|
3563
3563
|
className: className,
|
|
3564
3564
|
slotId: slotId,
|
|
3565
3565
|
networkID: networkID,
|
|
3566
|
-
sizes:
|
|
3566
|
+
sizes: [[1025, 100]],
|
|
3567
3567
|
adUnit: adUnit,
|
|
3568
3568
|
targeting: adTargeting,
|
|
3569
3569
|
refreshFlag: refreshFlag,
|
|
@@ -3767,84 +3767,6 @@ var ADWelcome = function ADWelcome(_ref) {
|
|
|
3767
3767
|
);
|
|
3768
3768
|
};
|
|
3769
3769
|
|
|
3770
|
-
var ADSponsoredResources = function ADSponsoredResources(_ref) {
|
|
3771
|
-
var sponsoredAd = _ref.sponsoredAd,
|
|
3772
|
-
_ref$minScreenWidth = _ref.minScreenWidth,
|
|
3773
|
-
minScreenWidth = _ref$minScreenWidth === undefined ? 1200 : _ref$minScreenWidth;
|
|
3774
|
-
var className = sponsoredAd.className,
|
|
3775
|
-
slotId = sponsoredAd.slotId,
|
|
3776
|
-
adUnit = sponsoredAd.adUnit,
|
|
3777
|
-
_sponsoredAd$targetin = sponsoredAd.targeting,
|
|
3778
|
-
targeting = _sponsoredAd$targetin === undefined ? {} : _sponsoredAd$targetin,
|
|
3779
|
-
_sponsoredAd$position = sponsoredAd.position,
|
|
3780
|
-
position = _sponsoredAd$position === undefined ? 'sponsor' : _sponsoredAd$position,
|
|
3781
|
-
networkID = sponsoredAd.networkID,
|
|
3782
|
-
sizes = sponsoredAd.sizes;
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
var adTargeting = {
|
|
3786
|
-
content_placement: targeting.content_placement,
|
|
3787
|
-
tags: targeting.tags,
|
|
3788
|
-
document_group: targeting.document_group,
|
|
3789
|
-
document_url: targeting.document_url,
|
|
3790
|
-
pos: position,
|
|
3791
|
-
campaign_id: targeting.campaign_id,
|
|
3792
|
-
issue_url: targeting.issue_url,
|
|
3793
|
-
publication_url: targeting.publication_url
|
|
3794
|
-
};
|
|
3795
|
-
|
|
3796
|
-
var _useState = useState(false),
|
|
3797
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
3798
|
-
widthFlag = _useState2[0],
|
|
3799
|
-
setWidthFlag = _useState2[1];
|
|
3800
|
-
|
|
3801
|
-
useEffect(function () {
|
|
3802
|
-
if (window && window.innerWidth >= minScreenWidth) {
|
|
3803
|
-
setWidthFlag(true);
|
|
3804
|
-
}
|
|
3805
|
-
}, [minScreenWidth]);
|
|
3806
|
-
|
|
3807
|
-
var collapseAd = function collapseAd() {
|
|
3808
|
-
var parent = document.getElementById('sponsored-ad-wrapper');
|
|
3809
|
-
parent.style.height = '0%';
|
|
3810
|
-
parent.style.width = '0%';
|
|
3811
|
-
parent.style.display = 'none';
|
|
3812
|
-
};
|
|
3813
|
-
|
|
3814
|
-
var checkIsAdFound = function checkIsAdFound(isFound) {
|
|
3815
|
-
if (isFound) {
|
|
3816
|
-
var parent = document.getElementById('sponsored-ad-wrapper');
|
|
3817
|
-
parent.style.display = 'block';
|
|
3818
|
-
} else {
|
|
3819
|
-
collapseAd();
|
|
3820
|
-
}
|
|
3821
|
-
};
|
|
3822
|
-
if (widthFlag) {
|
|
3823
|
-
return React__default.createElement(
|
|
3824
|
-
React__default.Fragment,
|
|
3825
|
-
null,
|
|
3826
|
-
React__default.createElement(
|
|
3827
|
-
'div',
|
|
3828
|
-
{ id: 'sponsored-ad-wrapper', className: 'sponsored-ad-wrapper' },
|
|
3829
|
-
React__default.createElement(
|
|
3830
|
-
'div',
|
|
3831
|
-
{ className: 'sponsored-ad' },
|
|
3832
|
-
React__default.createElement(DFPAdSlot, {
|
|
3833
|
-
className: className,
|
|
3834
|
-
slotId: slotId,
|
|
3835
|
-
networkID: networkID,
|
|
3836
|
-
sizes: sizes,
|
|
3837
|
-
adUnit: adUnit,
|
|
3838
|
-
targeting: adTargeting,
|
|
3839
|
-
refreshFlag: false,
|
|
3840
|
-
checkIsAdFound: checkIsAdFound
|
|
3841
|
-
})
|
|
3842
|
-
)
|
|
3843
|
-
)
|
|
3844
|
-
);
|
|
3845
|
-
} else return null;
|
|
3846
|
-
};
|
|
3847
|
-
|
|
3848
3770
|
var urlFor$2 = function urlFor(source, builder) {
|
|
3849
3771
|
return builder.image(source).auto('format');
|
|
3850
3772
|
};
|
|
@@ -14305,7 +14227,7 @@ var MultiFigure = function MultiFigure(props) {
|
|
|
14305
14227
|
};
|
|
14306
14228
|
|
|
14307
14229
|
var Figure = dynamic(function () {
|
|
14308
|
-
return import('./Figure-
|
|
14230
|
+
return import('./Figure-cc1affbe.js');
|
|
14309
14231
|
}, { ssr: false });
|
|
14310
14232
|
|
|
14311
14233
|
var checkUrlIsExternal = function checkUrlIsExternal(url) {
|
|
@@ -17764,7 +17686,7 @@ var Article = function Article(props) {
|
|
|
17764
17686
|
parent.style.display = 'none';
|
|
17765
17687
|
setContextualADFlag(false);
|
|
17766
17688
|
} else {
|
|
17767
|
-
if (body[1]._type === 'figure') {
|
|
17689
|
+
if (body[0]._type === 'figure' || body[1]._type === 'figure' || body[2]._type === 'figure' || body[3]._type === 'figure') {
|
|
17768
17690
|
setContextualADFlag(true);
|
|
17769
17691
|
}
|
|
17770
17692
|
}
|
|
@@ -17774,16 +17696,17 @@ var Article = function Article(props) {
|
|
|
17774
17696
|
React__default.Fragment,
|
|
17775
17697
|
null,
|
|
17776
17698
|
React__default.createElement(BlockContent, _extends$2({
|
|
17777
|
-
serializers: getSerializers(client, pageview, videoAccountIDs, function () {}, true, drupalLeadSettings, currentPage, false
|
|
17699
|
+
serializers: getSerializers(client, pageview, videoAccountIDs, function () {}, true, drupalLeadSettings, currentPage, false),
|
|
17778
17700
|
blocks: [].concat(_toConsumableArray(body.slice(0, _selectedIndex))),
|
|
17779
17701
|
imageOptions: { w: 320, h: 240, fit: 'max' }
|
|
17780
17702
|
}, client.config())),
|
|
17781
|
-
React__default.createElement('span', { className: 'clearfix' }),
|
|
17703
|
+
contextualADFlag && React__default.createElement('span', { className: 'clearfix' }),
|
|
17782
17704
|
React__default.createElement(
|
|
17783
17705
|
'div',
|
|
17784
17706
|
{ id: 'contextual-native-ad-' + payload._id, className: 'contextual-native-ad' },
|
|
17785
17707
|
React__default.createElement(DFPAdSlot, _extends$2({}, payload.contextualAD, { refreshFlag: false, checkIsAdFound: _checkIsAdFound }))
|
|
17786
17708
|
),
|
|
17709
|
+
contextualADFlag && React__default.createElement('span', { className: 'clearfix' }),
|
|
17787
17710
|
React__default.createElement(BlockContent, _extends$2({
|
|
17788
17711
|
serializers: getSerializers(client, pageview, videoAccountIDs, function () {}, true, drupalLeadSettings, currentPage, false),
|
|
17789
17712
|
blocks: [].concat(_toConsumableArray(body.slice(_selectedIndex))),
|
|
@@ -23433,4 +23356,4 @@ var getQuery = function getQuery(type) {
|
|
|
23433
23356
|
}
|
|
23434
23357
|
};
|
|
23435
23358
|
|
|
23436
|
-
export { AD300x250, AD300x250x600, ADFloatingFooter, ADFooter, ADGutter,
|
|
23359
|
+
export { AD300x250, AD300x250x600, ADFloatingFooter, ADFooter, ADGutter, ADWelcome, AccordionPanel, AdSlotsProvider, AlphabeticList, ArticleDetailDropdown, ArticleQueue, auth as Auth, Breadcrumbs$1 as Breadcrumbs, CMEDeck, ConferenceArticleCard, EventsDeck, Feature, fbsHero as ForbesHero, GridHero, Hero, HighlightenVideo, HorizontalHero, InfiniteScrollDeck, KMTracker, OncliveHero, OncliveLargeHero, PdfDownload, PopUpModal, PublicationLanding, RelatedContent, RelatedTopicsDropdown, SetCookie, SocialShare$1 as SocialShare, VerticalHero, View, YahooHero, getKeywords, getQuery, getSerializers, getSeriesDetail, getTargeting, urlFor$6 as urlFor };
|