You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
824 lines
31 KiB
824 lines
31 KiB
(self["webpackChunk"] = self["webpackChunk"] || []).push([[42102],{
|
|
|
|
/***/ 34804:
|
|
/*!*****************************************************************!*\
|
|
!*** ./node_modules/@ant-design/icons/es/icons/DownOutlined.js ***!
|
|
\*****************************************************************/
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
"use strict";
|
|
/* harmony import */ var _babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/esm/objectSpread2 */ 1413);
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ 67294);
|
|
/* harmony import */ var _ant_design_icons_svg_es_asn_DownOutlined__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @ant-design/icons-svg/es/asn/DownOutlined */ 66023);
|
|
/* harmony import */ var _components_AntdIcon__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../components/AntdIcon */ 7918);
|
|
|
|
// GENERATE BY ./scripts/generate.ts
|
|
// DON NOT EDIT IT MANUALLY
|
|
|
|
|
|
|
|
var DownOutlined = function DownOutlined(props, ref) {
|
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_AntdIcon__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z, (0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z)((0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z)({}, props), {}, {
|
|
ref: ref,
|
|
icon: _ant_design_icons_svg_es_asn_DownOutlined__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z
|
|
}));
|
|
};
|
|
DownOutlined.displayName = 'DownOutlined';
|
|
/* harmony default export */ __webpack_exports__["Z"] = (/*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.forwardRef(DownOutlined));
|
|
|
|
/***/ }),
|
|
|
|
/***/ 48783:
|
|
/*!****************************************************************!*\
|
|
!*** ./node_modules/antd/es/_util/throttleByAnimationFrame.js ***!
|
|
\****************************************************************/
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
"use strict";
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ "U": function() { return /* binding */ throttleByAnimationFrameDecorator; },
|
|
/* harmony export */ "t": function() { return /* binding */ throttleByAnimationFrame; }
|
|
/* harmony export */ });
|
|
/* harmony import */ var _babel_runtime_helpers_esm_toConsumableArray__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/esm/toConsumableArray */ 74902);
|
|
/* harmony import */ var rc_util_es_raf__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! rc-util/es/raf */ 75164);
|
|
|
|
|
|
function throttleByAnimationFrame(fn) {
|
|
var requestId;
|
|
var later = function later(args) {
|
|
return function () {
|
|
requestId = null;
|
|
fn.apply(void 0, (0,_babel_runtime_helpers_esm_toConsumableArray__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z)(args));
|
|
};
|
|
};
|
|
var throttled = function throttled() {
|
|
if (requestId == null) {
|
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
args[_key] = arguments[_key];
|
|
}
|
|
requestId = (0,rc_util_es_raf__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)(later(args));
|
|
}
|
|
};
|
|
throttled.cancel = function () {
|
|
rc_util_es_raf__WEBPACK_IMPORTED_MODULE_0__/* ["default"].cancel */ .Z.cancel(requestId);
|
|
requestId = null;
|
|
};
|
|
return throttled;
|
|
}
|
|
function throttleByAnimationFrameDecorator() {
|
|
return function throttle(target, key, descriptor) {
|
|
var fn = descriptor.value;
|
|
var definingProperty = false;
|
|
return {
|
|
configurable: true,
|
|
get: function get() {
|
|
// In IE11 calling Object.defineProperty has a side-effect of evaluating the
|
|
// getter for the property which is being replaced. This causes infinite
|
|
// recursion and an "Out of stack space" error.
|
|
// eslint-disable-next-line no-prototype-builtins
|
|
if (definingProperty || this === target.prototype || this.hasOwnProperty(key)) {
|
|
/* istanbul ignore next */
|
|
return fn;
|
|
}
|
|
var boundFn = throttleByAnimationFrame(fn.bind(this));
|
|
definingProperty = true;
|
|
Object.defineProperty(this, key, {
|
|
value: boundFn,
|
|
configurable: true,
|
|
writable: true
|
|
});
|
|
definingProperty = false;
|
|
return boundFn;
|
|
}
|
|
};
|
|
};
|
|
}
|
|
|
|
/***/ }),
|
|
|
|
/***/ 15771:
|
|
/*!*********************************************************!*\
|
|
!*** ./node_modules/antd/es/affix/index.js + 1 modules ***!
|
|
\*********************************************************/
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
"Z": function() { return /* binding */ affix; }
|
|
});
|
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js
|
|
var esm_extends = __webpack_require__(87462);
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js
|
|
var defineProperty = __webpack_require__(4942);
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js
|
|
var classCallCheck = __webpack_require__(15671);
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/createClass.js
|
|
var createClass = __webpack_require__(43144);
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/inherits.js
|
|
var inherits = __webpack_require__(60136);
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/createSuper.js + 1 modules
|
|
var createSuper = __webpack_require__(51630);
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/typeof.js
|
|
var esm_typeof = __webpack_require__(71002);
|
|
// EXTERNAL MODULE: ./node_modules/classnames/index.js
|
|
var classnames = __webpack_require__(94184);
|
|
var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames);
|
|
// EXTERNAL MODULE: ./node_modules/rc-resize-observer/es/index.js + 4 modules
|
|
var es = __webpack_require__(48555);
|
|
// EXTERNAL MODULE: ./node_modules/rc-util/es/omit.js
|
|
var omit = __webpack_require__(98423);
|
|
// EXTERNAL MODULE: ./node_modules/react/index.js
|
|
var react = __webpack_require__(67294);
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/config-provider/context.js
|
|
var context = __webpack_require__(53124);
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/_util/throttleByAnimationFrame.js
|
|
var throttleByAnimationFrame = __webpack_require__(48783);
|
|
// EXTERNAL MODULE: ./node_modules/rc-util/es/Dom/addEventListener.js
|
|
var addEventListener = __webpack_require__(64019);
|
|
;// CONCATENATED MODULE: ./node_modules/antd/es/affix/utils.js
|
|
|
|
function getTargetRect(target) {
|
|
return target !== window ? target.getBoundingClientRect() : {
|
|
top: 0,
|
|
bottom: window.innerHeight
|
|
};
|
|
}
|
|
function getFixedTop(placeholderReact, targetRect, offsetTop) {
|
|
if (offsetTop !== undefined && targetRect.top > placeholderReact.top - offsetTop) {
|
|
return offsetTop + targetRect.top;
|
|
}
|
|
return undefined;
|
|
}
|
|
function getFixedBottom(placeholderReact, targetRect, offsetBottom) {
|
|
if (offsetBottom !== undefined && targetRect.bottom < placeholderReact.bottom + offsetBottom) {
|
|
var targetBottomOffset = window.innerHeight - targetRect.bottom;
|
|
return offsetBottom + targetBottomOffset;
|
|
}
|
|
return undefined;
|
|
}
|
|
// ======================== Observer ========================
|
|
var TRIGGER_EVENTS = ['resize', 'scroll', 'touchstart', 'touchmove', 'touchend', 'pageshow', 'load'];
|
|
var observerEntities = [];
|
|
function getObserverEntities() {
|
|
// Only used in test env. Can be removed if refactor.
|
|
return observerEntities;
|
|
}
|
|
function addObserveTarget(target, affix) {
|
|
if (!target) {
|
|
return;
|
|
}
|
|
var entity = observerEntities.find(function (item) {
|
|
return item.target === target;
|
|
});
|
|
if (entity) {
|
|
entity.affixList.push(affix);
|
|
} else {
|
|
entity = {
|
|
target: target,
|
|
affixList: [affix],
|
|
eventHandlers: {}
|
|
};
|
|
observerEntities.push(entity);
|
|
// Add listener
|
|
TRIGGER_EVENTS.forEach(function (eventName) {
|
|
entity.eventHandlers[eventName] = (0,addEventListener/* default */.Z)(target, eventName, function () {
|
|
entity.affixList.forEach(function (targetAffix) {
|
|
targetAffix.lazyUpdatePosition();
|
|
});
|
|
});
|
|
});
|
|
}
|
|
}
|
|
function removeObserveTarget(affix) {
|
|
var observerEntity = observerEntities.find(function (oriObserverEntity) {
|
|
var hasAffix = oriObserverEntity.affixList.some(function (item) {
|
|
return item === affix;
|
|
});
|
|
if (hasAffix) {
|
|
oriObserverEntity.affixList = oriObserverEntity.affixList.filter(function (item) {
|
|
return item !== affix;
|
|
});
|
|
}
|
|
return hasAffix;
|
|
});
|
|
if (observerEntity && observerEntity.affixList.length === 0) {
|
|
observerEntities = observerEntities.filter(function (item) {
|
|
return item !== observerEntity;
|
|
});
|
|
// Remove listener
|
|
TRIGGER_EVENTS.forEach(function (eventName) {
|
|
var handler = observerEntity.eventHandlers[eventName];
|
|
if (handler && handler.remove) {
|
|
handler.remove();
|
|
}
|
|
});
|
|
}
|
|
}
|
|
;// CONCATENATED MODULE: ./node_modules/antd/es/affix/index.js
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var __decorate = undefined && undefined.__decorate || function (decorators, target, key, desc) {
|
|
var c = arguments.length,
|
|
r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
|
|
d;
|
|
if ((typeof Reflect === "undefined" ? "undefined" : (0,esm_typeof/* default */.Z)(Reflect)) === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function getDefaultTarget() {
|
|
return typeof window !== 'undefined' ? window : null;
|
|
}
|
|
var AffixStatus;
|
|
(function (AffixStatus) {
|
|
AffixStatus[AffixStatus["None"] = 0] = "None";
|
|
AffixStatus[AffixStatus["Prepare"] = 1] = "Prepare";
|
|
})(AffixStatus || (AffixStatus = {}));
|
|
var Affix = /*#__PURE__*/function (_React$Component) {
|
|
(0,inherits/* default */.Z)(Affix, _React$Component);
|
|
var _super = (0,createSuper/* default */.Z)(Affix);
|
|
function Affix() {
|
|
var _this;
|
|
(0,classCallCheck/* default */.Z)(this, Affix);
|
|
_this = _super.apply(this, arguments);
|
|
_this.state = {
|
|
status: AffixStatus.None,
|
|
lastAffix: false,
|
|
prevTarget: null
|
|
};
|
|
_this.getOffsetTop = function () {
|
|
var _this$props = _this.props,
|
|
offsetBottom = _this$props.offsetBottom,
|
|
offsetTop = _this$props.offsetTop;
|
|
return offsetBottom === undefined && offsetTop === undefined ? 0 : offsetTop;
|
|
};
|
|
_this.getOffsetBottom = function () {
|
|
return _this.props.offsetBottom;
|
|
};
|
|
_this.savePlaceholderNode = function (node) {
|
|
_this.placeholderNode = node;
|
|
};
|
|
_this.saveFixedNode = function (node) {
|
|
_this.fixedNode = node;
|
|
};
|
|
// =================== Measure ===================
|
|
_this.measure = function () {
|
|
var _this$state = _this.state,
|
|
status = _this$state.status,
|
|
lastAffix = _this$state.lastAffix;
|
|
var onChange = _this.props.onChange;
|
|
var targetFunc = _this.getTargetFunc();
|
|
if (status !== AffixStatus.Prepare || !_this.fixedNode || !_this.placeholderNode || !targetFunc) {
|
|
return;
|
|
}
|
|
var offsetTop = _this.getOffsetTop();
|
|
var offsetBottom = _this.getOffsetBottom();
|
|
var targetNode = targetFunc();
|
|
if (!targetNode) {
|
|
return;
|
|
}
|
|
var newState = {
|
|
status: AffixStatus.None
|
|
};
|
|
var targetRect = getTargetRect(targetNode);
|
|
var placeholderReact = getTargetRect(_this.placeholderNode);
|
|
var fixedTop = getFixedTop(placeholderReact, targetRect, offsetTop);
|
|
var fixedBottom = getFixedBottom(placeholderReact, targetRect, offsetBottom);
|
|
if (placeholderReact.top === 0 && placeholderReact.left === 0 && placeholderReact.width === 0 && placeholderReact.height === 0) {
|
|
return;
|
|
}
|
|
if (fixedTop !== undefined) {
|
|
newState.affixStyle = {
|
|
position: 'fixed',
|
|
top: fixedTop,
|
|
width: placeholderReact.width,
|
|
height: placeholderReact.height
|
|
};
|
|
newState.placeholderStyle = {
|
|
width: placeholderReact.width,
|
|
height: placeholderReact.height
|
|
};
|
|
} else if (fixedBottom !== undefined) {
|
|
newState.affixStyle = {
|
|
position: 'fixed',
|
|
bottom: fixedBottom,
|
|
width: placeholderReact.width,
|
|
height: placeholderReact.height
|
|
};
|
|
newState.placeholderStyle = {
|
|
width: placeholderReact.width,
|
|
height: placeholderReact.height
|
|
};
|
|
}
|
|
newState.lastAffix = !!newState.affixStyle;
|
|
if (onChange && lastAffix !== newState.lastAffix) {
|
|
onChange(newState.lastAffix);
|
|
}
|
|
_this.setState(newState);
|
|
};
|
|
// @ts-ignore TS6133
|
|
_this.prepareMeasure = function () {
|
|
// event param is used before. Keep compatible ts define here.
|
|
_this.setState({
|
|
status: AffixStatus.Prepare,
|
|
affixStyle: undefined,
|
|
placeholderStyle: undefined
|
|
});
|
|
// Test if `updatePosition` called
|
|
if (false) { var onTestUpdatePosition; }
|
|
};
|
|
return _this;
|
|
}
|
|
(0,createClass/* default */.Z)(Affix, [{
|
|
key: "getTargetFunc",
|
|
value: function getTargetFunc() {
|
|
var getTargetContainer = this.context.getTargetContainer;
|
|
var target = this.props.target;
|
|
if (target !== undefined) {
|
|
return target;
|
|
}
|
|
return getTargetContainer !== null && getTargetContainer !== void 0 ? getTargetContainer : getDefaultTarget;
|
|
}
|
|
// Event handler
|
|
}, {
|
|
key: "componentDidMount",
|
|
value: function componentDidMount() {
|
|
var _this2 = this;
|
|
var targetFunc = this.getTargetFunc();
|
|
if (targetFunc) {
|
|
// [Legacy] Wait for parent component ref has its value.
|
|
// We should use target as directly element instead of function which makes element check hard.
|
|
this.timeout = setTimeout(function () {
|
|
addObserveTarget(targetFunc(), _this2);
|
|
// Mock Event object.
|
|
_this2.updatePosition();
|
|
});
|
|
}
|
|
}
|
|
}, {
|
|
key: "componentDidUpdate",
|
|
value: function componentDidUpdate(prevProps) {
|
|
var prevTarget = this.state.prevTarget;
|
|
var targetFunc = this.getTargetFunc();
|
|
var newTarget = (targetFunc === null || targetFunc === void 0 ? void 0 : targetFunc()) || null;
|
|
if (prevTarget !== newTarget) {
|
|
removeObserveTarget(this);
|
|
if (newTarget) {
|
|
addObserveTarget(newTarget, this);
|
|
// Mock Event object.
|
|
this.updatePosition();
|
|
}
|
|
// eslint-disable-next-line react/no-did-update-set-state
|
|
this.setState({
|
|
prevTarget: newTarget
|
|
});
|
|
}
|
|
if (prevProps.offsetTop !== this.props.offsetTop || prevProps.offsetBottom !== this.props.offsetBottom) {
|
|
this.updatePosition();
|
|
}
|
|
this.measure();
|
|
}
|
|
}, {
|
|
key: "componentWillUnmount",
|
|
value: function componentWillUnmount() {
|
|
clearTimeout(this.timeout);
|
|
removeObserveTarget(this);
|
|
this.updatePosition.cancel();
|
|
// https://github.com/ant-design/ant-design/issues/22683
|
|
this.lazyUpdatePosition.cancel();
|
|
}
|
|
// Handle realign logic
|
|
}, {
|
|
key: "updatePosition",
|
|
value: function updatePosition() {
|
|
this.prepareMeasure();
|
|
}
|
|
}, {
|
|
key: "lazyUpdatePosition",
|
|
value: function lazyUpdatePosition() {
|
|
var targetFunc = this.getTargetFunc();
|
|
var affixStyle = this.state.affixStyle;
|
|
// Check position change before measure to make Safari smooth
|
|
if (targetFunc && affixStyle) {
|
|
var offsetTop = this.getOffsetTop();
|
|
var offsetBottom = this.getOffsetBottom();
|
|
var targetNode = targetFunc();
|
|
if (targetNode && this.placeholderNode) {
|
|
var targetRect = getTargetRect(targetNode);
|
|
var placeholderReact = getTargetRect(this.placeholderNode);
|
|
var fixedTop = getFixedTop(placeholderReact, targetRect, offsetTop);
|
|
var fixedBottom = getFixedBottom(placeholderReact, targetRect, offsetBottom);
|
|
if (fixedTop !== undefined && affixStyle.top === fixedTop || fixedBottom !== undefined && affixStyle.bottom === fixedBottom) {
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
// Directly call prepare measure since it's already throttled.
|
|
this.prepareMeasure();
|
|
}
|
|
// =================== Render ===================
|
|
}, {
|
|
key: "render",
|
|
value: function render() {
|
|
var _this3 = this;
|
|
var _this$state2 = this.state,
|
|
affixStyle = _this$state2.affixStyle,
|
|
placeholderStyle = _this$state2.placeholderStyle;
|
|
var _this$props2 = this.props,
|
|
affixPrefixCls = _this$props2.affixPrefixCls,
|
|
children = _this$props2.children;
|
|
var className = classnames_default()((0,defineProperty/* default */.Z)({}, affixPrefixCls, !!affixStyle));
|
|
var props = (0,omit/* default */.Z)(this.props, ['prefixCls', 'offsetTop', 'offsetBottom', 'target', 'onChange', 'affixPrefixCls']);
|
|
// Omit this since `onTestUpdatePosition` only works on test.
|
|
if (false) {}
|
|
return /*#__PURE__*/react.createElement(es/* default */.Z, {
|
|
onResize: function onResize() {
|
|
_this3.updatePosition();
|
|
}
|
|
}, /*#__PURE__*/react.createElement("div", (0,esm_extends/* default */.Z)({}, props, {
|
|
ref: this.savePlaceholderNode
|
|
}), affixStyle && /*#__PURE__*/react.createElement("div", {
|
|
style: placeholderStyle,
|
|
"aria-hidden": "true"
|
|
}), /*#__PURE__*/react.createElement("div", {
|
|
className: className,
|
|
ref: this.saveFixedNode,
|
|
style: affixStyle
|
|
}, /*#__PURE__*/react.createElement(es/* default */.Z, {
|
|
onResize: function onResize() {
|
|
_this3.updatePosition();
|
|
}
|
|
}, children))));
|
|
}
|
|
}]);
|
|
return Affix;
|
|
}(react.Component);
|
|
Affix.contextType = context/* ConfigContext */.E_;
|
|
__decorate([(0,throttleByAnimationFrame/* throttleByAnimationFrameDecorator */.U)()], Affix.prototype, "updatePosition", null);
|
|
__decorate([(0,throttleByAnimationFrame/* throttleByAnimationFrameDecorator */.U)()], Affix.prototype, "lazyUpdatePosition", null);
|
|
var AffixFC = /*#__PURE__*/react.forwardRef(function (props, ref) {
|
|
var customizePrefixCls = props.prefixCls;
|
|
var _React$useContext = react.useContext(context/* ConfigContext */.E_),
|
|
getPrefixCls = _React$useContext.getPrefixCls;
|
|
var affixPrefixCls = getPrefixCls('affix', customizePrefixCls);
|
|
var affixProps = (0,esm_extends/* default */.Z)((0,esm_extends/* default */.Z)({}, props), {
|
|
affixPrefixCls: affixPrefixCls
|
|
});
|
|
return /*#__PURE__*/react.createElement(Affix, (0,esm_extends/* default */.Z)({}, affixProps, {
|
|
ref: ref
|
|
}));
|
|
});
|
|
if (false) {}
|
|
/* harmony default export */ var affix = (AffixFC);
|
|
|
|
/***/ }),
|
|
|
|
/***/ 48283:
|
|
/*!***************************************************************!*\
|
|
!*** ./node_modules/antd/es/affix/style/index.js + 1 modules ***!
|
|
\***************************************************************/
|
|
/***/ (function(__unused_webpack_module, __unused_webpack___webpack_exports__, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/style/default.less
|
|
var style_default = __webpack_require__(43146);
|
|
;// CONCATENATED MODULE: ./node_modules/antd/es/affix/style/index.less
|
|
// extracted by mini-css-extract-plugin
|
|
|
|
;// CONCATENATED MODULE: ./node_modules/antd/es/affix/style/index.js
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 57761:
|
|
/*!*********************************************************************!*\
|
|
!*** ./node_modules/react-infinite-scroller/dist/InfiniteScroll.js ***!
|
|
\*********************************************************************/
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", ({
|
|
value: true
|
|
}));
|
|
|
|
var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
|
|
var _react = __webpack_require__(/*! react */ 67294);
|
|
|
|
var _react2 = _interopRequireDefault(_react);
|
|
|
|
var _propTypes = __webpack_require__(/*! prop-types */ 45697);
|
|
|
|
var _propTypes2 = _interopRequireDefault(_propTypes);
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
|
|
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
|
|
|
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
|
|
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
|
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
|
|
|
var InfiniteScroll = function (_Component) {
|
|
_inherits(InfiniteScroll, _Component);
|
|
|
|
function InfiniteScroll(props) {
|
|
_classCallCheck(this, InfiniteScroll);
|
|
|
|
var _this = _possibleConstructorReturn(this, (InfiniteScroll.__proto__ || Object.getPrototypeOf(InfiniteScroll)).call(this, props));
|
|
|
|
_this.scrollListener = _this.scrollListener.bind(_this);
|
|
_this.eventListenerOptions = _this.eventListenerOptions.bind(_this);
|
|
_this.mousewheelListener = _this.mousewheelListener.bind(_this);
|
|
return _this;
|
|
}
|
|
|
|
_createClass(InfiniteScroll, [{
|
|
key: 'componentDidMount',
|
|
value: function componentDidMount() {
|
|
this.pageLoaded = this.props.pageStart;
|
|
this.options = this.eventListenerOptions();
|
|
this.attachScrollListener();
|
|
}
|
|
}, {
|
|
key: 'componentDidUpdate',
|
|
value: function componentDidUpdate() {
|
|
if (this.props.isReverse && this.loadMore) {
|
|
var parentElement = this.getParentElement(this.scrollComponent);
|
|
parentElement.scrollTop = parentElement.scrollHeight - this.beforeScrollHeight + this.beforeScrollTop;
|
|
this.loadMore = false;
|
|
}
|
|
this.attachScrollListener();
|
|
}
|
|
}, {
|
|
key: 'componentWillUnmount',
|
|
value: function componentWillUnmount() {
|
|
this.detachScrollListener();
|
|
this.detachMousewheelListener();
|
|
}
|
|
}, {
|
|
key: 'isPassiveSupported',
|
|
value: function isPassiveSupported() {
|
|
var passive = false;
|
|
|
|
var testOptions = {
|
|
get passive() {
|
|
passive = true;
|
|
}
|
|
};
|
|
|
|
try {
|
|
document.addEventListener('test', null, testOptions);
|
|
document.removeEventListener('test', null, testOptions);
|
|
} catch (e) {
|
|
// ignore
|
|
}
|
|
return passive;
|
|
}
|
|
}, {
|
|
key: 'eventListenerOptions',
|
|
value: function eventListenerOptions() {
|
|
var options = this.props.useCapture;
|
|
|
|
if (this.isPassiveSupported()) {
|
|
options = {
|
|
useCapture: this.props.useCapture,
|
|
passive: true
|
|
};
|
|
}
|
|
return options;
|
|
}
|
|
|
|
// Set a defaut loader for all your `InfiniteScroll` components
|
|
|
|
}, {
|
|
key: 'setDefaultLoader',
|
|
value: function setDefaultLoader(loader) {
|
|
this.defaultLoader = loader;
|
|
}
|
|
}, {
|
|
key: 'detachMousewheelListener',
|
|
value: function detachMousewheelListener() {
|
|
var scrollEl = window;
|
|
if (this.props.useWindow === false) {
|
|
scrollEl = this.scrollComponent.parentNode;
|
|
}
|
|
|
|
scrollEl.removeEventListener('mousewheel', this.mousewheelListener, this.options ? this.options : this.props.useCapture);
|
|
}
|
|
}, {
|
|
key: 'detachScrollListener',
|
|
value: function detachScrollListener() {
|
|
var scrollEl = window;
|
|
if (this.props.useWindow === false) {
|
|
scrollEl = this.getParentElement(this.scrollComponent);
|
|
}
|
|
|
|
scrollEl.removeEventListener('scroll', this.scrollListener, this.options ? this.options : this.props.useCapture);
|
|
scrollEl.removeEventListener('resize', this.scrollListener, this.options ? this.options : this.props.useCapture);
|
|
}
|
|
}, {
|
|
key: 'getParentElement',
|
|
value: function getParentElement(el) {
|
|
var scrollParent = this.props.getScrollParent && this.props.getScrollParent();
|
|
if (scrollParent != null) {
|
|
return scrollParent;
|
|
}
|
|
return el && el.parentNode;
|
|
}
|
|
}, {
|
|
key: 'filterProps',
|
|
value: function filterProps(props) {
|
|
return props;
|
|
}
|
|
}, {
|
|
key: 'attachScrollListener',
|
|
value: function attachScrollListener() {
|
|
var parentElement = this.getParentElement(this.scrollComponent);
|
|
|
|
if (!this.props.hasMore || !parentElement) {
|
|
return;
|
|
}
|
|
|
|
var scrollEl = window;
|
|
if (this.props.useWindow === false) {
|
|
scrollEl = parentElement;
|
|
}
|
|
|
|
scrollEl.addEventListener('mousewheel', this.mousewheelListener, this.options ? this.options : this.props.useCapture);
|
|
scrollEl.addEventListener('scroll', this.scrollListener, this.options ? this.options : this.props.useCapture);
|
|
scrollEl.addEventListener('resize', this.scrollListener, this.options ? this.options : this.props.useCapture);
|
|
|
|
if (this.props.initialLoad) {
|
|
this.scrollListener();
|
|
}
|
|
}
|
|
}, {
|
|
key: 'mousewheelListener',
|
|
value: function mousewheelListener(e) {
|
|
// Prevents Chrome hangups
|
|
// See: https://stackoverflow.com/questions/47524205/random-high-content-download-time-in-chrome/47684257#47684257
|
|
if (e.deltaY === 1 && !this.isPassiveSupported()) {
|
|
e.preventDefault();
|
|
}
|
|
}
|
|
}, {
|
|
key: 'scrollListener',
|
|
value: function scrollListener() {
|
|
var el = this.scrollComponent;
|
|
var scrollEl = window;
|
|
var parentNode = this.getParentElement(el);
|
|
|
|
var offset = void 0;
|
|
if (this.props.useWindow) {
|
|
var doc = document.documentElement || document.body.parentNode || document.body;
|
|
var scrollTop = scrollEl.pageYOffset !== undefined ? scrollEl.pageYOffset : doc.scrollTop;
|
|
if (this.props.isReverse) {
|
|
offset = scrollTop;
|
|
} else {
|
|
offset = this.calculateOffset(el, scrollTop);
|
|
}
|
|
} else if (this.props.isReverse) {
|
|
offset = parentNode.scrollTop;
|
|
} else {
|
|
offset = el.scrollHeight - parentNode.scrollTop - parentNode.clientHeight;
|
|
}
|
|
|
|
// Here we make sure the element is visible as well as checking the offset
|
|
if (offset < Number(this.props.threshold) && el && el.offsetParent !== null) {
|
|
this.detachScrollListener();
|
|
this.beforeScrollHeight = parentNode.scrollHeight;
|
|
this.beforeScrollTop = parentNode.scrollTop;
|
|
// Call loadMore after detachScrollListener to allow for non-async loadMore functions
|
|
if (typeof this.props.loadMore === 'function') {
|
|
this.props.loadMore(this.pageLoaded += 1);
|
|
this.loadMore = true;
|
|
}
|
|
}
|
|
}
|
|
}, {
|
|
key: 'calculateOffset',
|
|
value: function calculateOffset(el, scrollTop) {
|
|
if (!el) {
|
|
return 0;
|
|
}
|
|
|
|
return this.calculateTopPosition(el) + (el.offsetHeight - scrollTop - window.innerHeight);
|
|
}
|
|
}, {
|
|
key: 'calculateTopPosition',
|
|
value: function calculateTopPosition(el) {
|
|
if (!el) {
|
|
return 0;
|
|
}
|
|
return el.offsetTop + this.calculateTopPosition(el.offsetParent);
|
|
}
|
|
}, {
|
|
key: 'render',
|
|
value: function render() {
|
|
var _this2 = this;
|
|
|
|
var renderProps = this.filterProps(this.props);
|
|
|
|
var children = renderProps.children,
|
|
element = renderProps.element,
|
|
hasMore = renderProps.hasMore,
|
|
initialLoad = renderProps.initialLoad,
|
|
isReverse = renderProps.isReverse,
|
|
loader = renderProps.loader,
|
|
loadMore = renderProps.loadMore,
|
|
pageStart = renderProps.pageStart,
|
|
ref = renderProps.ref,
|
|
threshold = renderProps.threshold,
|
|
useCapture = renderProps.useCapture,
|
|
useWindow = renderProps.useWindow,
|
|
getScrollParent = renderProps.getScrollParent,
|
|
props = _objectWithoutProperties(renderProps, ['children', 'element', 'hasMore', 'initialLoad', 'isReverse', 'loader', 'loadMore', 'pageStart', 'ref', 'threshold', 'useCapture', 'useWindow', 'getScrollParent']);
|
|
|
|
props.ref = function (node) {
|
|
_this2.scrollComponent = node;
|
|
if (ref) {
|
|
ref(node);
|
|
}
|
|
};
|
|
|
|
var childrenArray = [children];
|
|
if (hasMore) {
|
|
if (loader) {
|
|
isReverse ? childrenArray.unshift(loader) : childrenArray.push(loader);
|
|
} else if (this.defaultLoader) {
|
|
isReverse ? childrenArray.unshift(this.defaultLoader) : childrenArray.push(this.defaultLoader);
|
|
}
|
|
}
|
|
return _react2.default.createElement(element, props, childrenArray);
|
|
}
|
|
}]);
|
|
|
|
return InfiniteScroll;
|
|
}(_react.Component);
|
|
|
|
InfiniteScroll.propTypes = {
|
|
children: _propTypes2.default.node.isRequired,
|
|
element: _propTypes2.default.node,
|
|
hasMore: _propTypes2.default.bool,
|
|
initialLoad: _propTypes2.default.bool,
|
|
isReverse: _propTypes2.default.bool,
|
|
loader: _propTypes2.default.node,
|
|
loadMore: _propTypes2.default.func.isRequired,
|
|
pageStart: _propTypes2.default.number,
|
|
ref: _propTypes2.default.func,
|
|
getScrollParent: _propTypes2.default.func,
|
|
threshold: _propTypes2.default.number,
|
|
useCapture: _propTypes2.default.bool,
|
|
useWindow: _propTypes2.default.bool
|
|
};
|
|
InfiniteScroll.defaultProps = {
|
|
element: 'div',
|
|
hasMore: false,
|
|
initialLoad: true,
|
|
pageStart: 0,
|
|
ref: null,
|
|
threshold: 250,
|
|
useWindow: true,
|
|
isReverse: false,
|
|
useCapture: false,
|
|
loader: null,
|
|
getScrollParent: null
|
|
};
|
|
exports["default"] = InfiniteScroll;
|
|
module.exports = exports['default'];
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 246:
|
|
/*!*******************************************************!*\
|
|
!*** ./node_modules/react-infinite-scroller/index.js ***!
|
|
\*******************************************************/
|
|
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
|
|
|
|
module.exports = __webpack_require__(/*! ./dist/InfiniteScroll */ 57761)
|
|
|
|
|
|
/***/ })
|
|
|
|
}]); |