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.
823 lines
31 KiB
823 lines
31 KiB
"use strict";
|
|
(self["webpackChunk"] = self["webpackChunk"] || []).push([[24192],{
|
|
|
|
/***/ 48783:
|
|
/*!****************************************************************!*\
|
|
!*** ./node_modules/antd/es/_util/throttleByAnimationFrame.js ***!
|
|
\****************************************************************/
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
/* 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__) {
|
|
|
|
|
|
// 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__) {
|
|
|
|
|
|
// 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
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 37802:
|
|
/*!**********************************************************!*\
|
|
!*** ./node_modules/antd/es/anchor/index.js + 3 modules ***!
|
|
\**********************************************************/
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
"Z": function() { return /* binding */ es_anchor; }
|
|
});
|
|
|
|
// 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/toConsumableArray.js + 2 modules
|
|
var toConsumableArray = __webpack_require__(74902);
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js + 1 modules
|
|
var slicedToArray = __webpack_require__(97685);
|
|
// 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-util/es/Dom/addEventListener.js
|
|
var addEventListener = __webpack_require__(64019);
|
|
// EXTERNAL MODULE: ./node_modules/react/index.js
|
|
var react = __webpack_require__(67294);
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/affix/index.js + 1 modules
|
|
var es_affix = __webpack_require__(15771);
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/config-provider/context.js
|
|
var config_provider_context = __webpack_require__(53124);
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/_util/getScroll.js
|
|
var getScroll = __webpack_require__(66367);
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/_util/scrollTo.js + 1 modules
|
|
var scrollTo = __webpack_require__(58375);
|
|
;// CONCATENATED MODULE: ./node_modules/antd/es/anchor/context.js
|
|
|
|
var AnchorContext = /*#__PURE__*/react.createContext(undefined);
|
|
/* harmony default export */ var anchor_context = (AnchorContext);
|
|
;// CONCATENATED MODULE: ./node_modules/antd/es/anchor/Anchor.js
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function getDefaultContainer() {
|
|
return window;
|
|
}
|
|
function getOffsetTop(element, container) {
|
|
if (!element.getClientRects().length) {
|
|
return 0;
|
|
}
|
|
var rect = element.getBoundingClientRect();
|
|
if (rect.width || rect.height) {
|
|
if (container === window) {
|
|
container = element.ownerDocument.documentElement;
|
|
return rect.top - container.clientTop;
|
|
}
|
|
return rect.top - container.getBoundingClientRect().top;
|
|
}
|
|
return rect.top;
|
|
}
|
|
var sharpMatcherRegx = /#([\S ]+)$/;
|
|
var AnchorContent = function AnchorContent(props) {
|
|
var _a;
|
|
var prefixCls = props.anchorPrefixCls,
|
|
_props$className = props.className,
|
|
className = _props$className === void 0 ? '' : _props$className,
|
|
style = props.style,
|
|
offsetTop = props.offsetTop,
|
|
_props$affix = props.affix,
|
|
affix = _props$affix === void 0 ? true : _props$affix,
|
|
_props$showInkInFixed = props.showInkInFixed,
|
|
showInkInFixed = _props$showInkInFixed === void 0 ? false : _props$showInkInFixed,
|
|
children = props.children,
|
|
bounds = props.bounds,
|
|
targetOffset = props.targetOffset,
|
|
onClick = props.onClick,
|
|
onChange = props.onChange,
|
|
getContainer = props.getContainer,
|
|
getCurrentAnchor = props.getCurrentAnchor;
|
|
var _React$useState = react.useState([]),
|
|
_React$useState2 = (0,slicedToArray/* default */.Z)(_React$useState, 2),
|
|
links = _React$useState2[0],
|
|
setLinks = _React$useState2[1];
|
|
var _React$useState3 = react.useState(null),
|
|
_React$useState4 = (0,slicedToArray/* default */.Z)(_React$useState3, 2),
|
|
activeLink = _React$useState4[0],
|
|
setActiveLink = _React$useState4[1];
|
|
var activeLinkRef = react.useRef(activeLink);
|
|
var wrapperRef = react.useRef(null);
|
|
var spanLinkNode = react.useRef(null);
|
|
var animating = react.useRef(false);
|
|
var _React$useContext = react.useContext(config_provider_context/* ConfigContext */.E_),
|
|
direction = _React$useContext.direction,
|
|
getTargetContainer = _React$useContext.getTargetContainer;
|
|
var getCurrentContainer = (_a = getContainer !== null && getContainer !== void 0 ? getContainer : getTargetContainer) !== null && _a !== void 0 ? _a : getDefaultContainer;
|
|
var dependencyListItem = JSON.stringify(links);
|
|
var registerLink = react.useCallback(function (link) {
|
|
if (!links.includes(link)) {
|
|
setLinks(function (prev) {
|
|
return [].concat((0,toConsumableArray/* default */.Z)(prev), [link]);
|
|
});
|
|
}
|
|
}, [dependencyListItem]);
|
|
var unregisterLink = react.useCallback(function (link) {
|
|
if (links.includes(link)) {
|
|
setLinks(function (prev) {
|
|
return prev.filter(function (i) {
|
|
return i !== link;
|
|
});
|
|
});
|
|
}
|
|
}, [dependencyListItem]);
|
|
var updateInk = function updateInk() {
|
|
var _a;
|
|
var linkNode = (_a = wrapperRef.current) === null || _a === void 0 ? void 0 : _a.querySelector(".".concat(prefixCls, "-link-title-active"));
|
|
if (linkNode && spanLinkNode.current) {
|
|
spanLinkNode.current.style.top = "".concat(linkNode.offsetTop + linkNode.clientHeight / 2 - 4.5, "px");
|
|
}
|
|
};
|
|
var getInternalCurrentAnchor = function getInternalCurrentAnchor(_links) {
|
|
var _offsetTop = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
var _bounds = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 5;
|
|
var linkSections = [];
|
|
var container = getCurrentContainer();
|
|
_links.forEach(function (link) {
|
|
var sharpLinkMatch = sharpMatcherRegx.exec(link === null || link === void 0 ? void 0 : link.toString());
|
|
if (!sharpLinkMatch) {
|
|
return;
|
|
}
|
|
var target = document.getElementById(sharpLinkMatch[1]);
|
|
if (target) {
|
|
var top = getOffsetTop(target, container);
|
|
if (top < _offsetTop + _bounds) {
|
|
linkSections.push({
|
|
link: link,
|
|
top: top
|
|
});
|
|
}
|
|
}
|
|
});
|
|
if (linkSections.length) {
|
|
var maxSection = linkSections.reduce(function (prev, curr) {
|
|
return curr.top > prev.top ? curr : prev;
|
|
});
|
|
return maxSection.link;
|
|
}
|
|
return '';
|
|
};
|
|
var setCurrentActiveLink = function setCurrentActiveLink(link) {
|
|
if (activeLinkRef.current === link) {
|
|
return;
|
|
}
|
|
// https://github.com/ant-design/ant-design/issues/30584
|
|
var newLink = typeof getCurrentAnchor === 'function' ? getCurrentAnchor(link) : link;
|
|
setActiveLink(newLink);
|
|
activeLinkRef.current = newLink;
|
|
// onChange should respect the original link (which may caused by
|
|
// window scroll or user click), not the new link
|
|
onChange === null || onChange === void 0 ? void 0 : onChange(link);
|
|
};
|
|
var handleScroll = react.useCallback(function () {
|
|
if (animating.current) {
|
|
return;
|
|
}
|
|
if (typeof getCurrentAnchor === 'function') {
|
|
return;
|
|
}
|
|
var currentActiveLink = getInternalCurrentAnchor(links, targetOffset !== undefined ? targetOffset : offsetTop || 0, bounds);
|
|
setCurrentActiveLink(currentActiveLink);
|
|
}, [dependencyListItem, targetOffset, offsetTop]);
|
|
var handleScrollTo = react.useCallback(function (link) {
|
|
setCurrentActiveLink(link);
|
|
var container = getCurrentContainer();
|
|
var scrollTop = (0,getScroll/* default */.Z)(container, true);
|
|
var sharpLinkMatch = sharpMatcherRegx.exec(link);
|
|
if (!sharpLinkMatch) {
|
|
return;
|
|
}
|
|
var targetElement = document.getElementById(sharpLinkMatch[1]);
|
|
if (!targetElement) {
|
|
return;
|
|
}
|
|
var eleOffsetTop = getOffsetTop(targetElement, container);
|
|
var y = scrollTop + eleOffsetTop;
|
|
y -= targetOffset !== undefined ? targetOffset : offsetTop || 0;
|
|
animating.current = true;
|
|
(0,scrollTo/* default */.Z)(y, {
|
|
getContainer: getCurrentContainer,
|
|
callback: function callback() {
|
|
animating.current = false;
|
|
}
|
|
});
|
|
}, [targetOffset, offsetTop]);
|
|
var inkClass = classnames_default()((0,defineProperty/* default */.Z)({}, "".concat(prefixCls, "-ink-ball-visible"), activeLink), "".concat(prefixCls, "-ink-ball"));
|
|
var wrapperClass = classnames_default()("".concat(prefixCls, "-wrapper"), (0,defineProperty/* default */.Z)({}, "".concat(prefixCls, "-rtl"), direction === 'rtl'), className);
|
|
var anchorClass = classnames_default()(prefixCls, (0,defineProperty/* default */.Z)({}, "".concat(prefixCls, "-fixed"), !affix && !showInkInFixed));
|
|
var wrapperStyle = (0,esm_extends/* default */.Z)({
|
|
maxHeight: offsetTop ? "calc(100vh - ".concat(offsetTop, "px)") : '100vh'
|
|
}, style);
|
|
var anchorContent = /*#__PURE__*/react.createElement("div", {
|
|
ref: wrapperRef,
|
|
className: wrapperClass,
|
|
style: wrapperStyle
|
|
}, /*#__PURE__*/react.createElement("div", {
|
|
className: anchorClass
|
|
}, /*#__PURE__*/react.createElement("div", {
|
|
className: "".concat(prefixCls, "-ink")
|
|
}, /*#__PURE__*/react.createElement("span", {
|
|
className: inkClass,
|
|
ref: spanLinkNode
|
|
})), children));
|
|
react.useEffect(function () {
|
|
var scrollContainer = getCurrentContainer();
|
|
var scrollEvent = (0,addEventListener/* default */.Z)(scrollContainer, 'scroll', handleScroll);
|
|
handleScroll();
|
|
return function () {
|
|
scrollEvent === null || scrollEvent === void 0 ? void 0 : scrollEvent.remove();
|
|
};
|
|
}, [dependencyListItem]);
|
|
react.useEffect(function () {
|
|
if (typeof getCurrentAnchor === 'function') {
|
|
setCurrentActiveLink(getCurrentAnchor(activeLinkRef.current || ''));
|
|
}
|
|
}, [getCurrentAnchor]);
|
|
react.useEffect(function () {
|
|
updateInk();
|
|
}, [getCurrentAnchor, dependencyListItem, activeLink]);
|
|
var memoizedContextValue = react.useMemo(function () {
|
|
return {
|
|
registerLink: registerLink,
|
|
unregisterLink: unregisterLink,
|
|
scrollTo: handleScrollTo,
|
|
activeLink: activeLink,
|
|
onClick: onClick
|
|
};
|
|
}, [activeLink, onClick, handleScrollTo]);
|
|
return /*#__PURE__*/react.createElement(anchor_context.Provider, {
|
|
value: memoizedContextValue
|
|
}, affix ? /*#__PURE__*/react.createElement(es_affix/* default */.Z, {
|
|
offsetTop: offsetTop,
|
|
target: getCurrentContainer
|
|
}, anchorContent) : anchorContent);
|
|
};
|
|
var Anchor = function Anchor(props) {
|
|
var customizePrefixCls = props.prefixCls;
|
|
var _React$useContext2 = react.useContext(config_provider_context/* ConfigContext */.E_),
|
|
getPrefixCls = _React$useContext2.getPrefixCls;
|
|
var anchorPrefixCls = getPrefixCls('anchor', customizePrefixCls);
|
|
return /*#__PURE__*/react.createElement(AnchorContent, (0,esm_extends/* default */.Z)({}, props, {
|
|
anchorPrefixCls: anchorPrefixCls
|
|
}));
|
|
};
|
|
/* harmony default export */ var anchor_Anchor = (Anchor);
|
|
;// CONCATENATED MODULE: ./node_modules/antd/es/anchor/AnchorLink.js
|
|
|
|
|
|
|
|
|
|
|
|
var AnchorLink = function AnchorLink(props) {
|
|
var _props$href = props.href,
|
|
href = _props$href === void 0 ? '#' : _props$href,
|
|
title = props.title,
|
|
customizePrefixCls = props.prefixCls,
|
|
children = props.children,
|
|
className = props.className,
|
|
target = props.target;
|
|
var context = react.useContext(anchor_context);
|
|
var _ref = context || {},
|
|
registerLink = _ref.registerLink,
|
|
unregisterLink = _ref.unregisterLink,
|
|
scrollTo = _ref.scrollTo,
|
|
onClick = _ref.onClick,
|
|
activeLink = _ref.activeLink;
|
|
react.useEffect(function () {
|
|
registerLink === null || registerLink === void 0 ? void 0 : registerLink(href);
|
|
return function () {
|
|
unregisterLink === null || unregisterLink === void 0 ? void 0 : unregisterLink(href);
|
|
};
|
|
}, [href, registerLink, unregisterLink]);
|
|
var handleClick = function handleClick(e) {
|
|
onClick === null || onClick === void 0 ? void 0 : onClick(e, {
|
|
title: title,
|
|
href: href
|
|
});
|
|
scrollTo === null || scrollTo === void 0 ? void 0 : scrollTo(href);
|
|
};
|
|
return /*#__PURE__*/react.createElement(config_provider_context/* ConfigConsumer */.C, null, function (_ref2) {
|
|
var getPrefixCls = _ref2.getPrefixCls;
|
|
var prefixCls = getPrefixCls('anchor', customizePrefixCls);
|
|
var active = activeLink === href;
|
|
var wrapperClassName = classnames_default()("".concat(prefixCls, "-link"), className, (0,defineProperty/* default */.Z)({}, "".concat(prefixCls, "-link-active"), active));
|
|
var titleClassName = classnames_default()("".concat(prefixCls, "-link-title"), (0,defineProperty/* default */.Z)({}, "".concat(prefixCls, "-link-title-active"), active));
|
|
return /*#__PURE__*/react.createElement("div", {
|
|
className: wrapperClassName
|
|
}, /*#__PURE__*/react.createElement("a", {
|
|
className: titleClassName,
|
|
href: href,
|
|
title: typeof title === 'string' ? title : '',
|
|
target: target,
|
|
onClick: handleClick
|
|
}, title), children);
|
|
});
|
|
};
|
|
/* harmony default export */ var anchor_AnchorLink = (AnchorLink);
|
|
;// CONCATENATED MODULE: ./node_modules/antd/es/anchor/index.js
|
|
|
|
|
|
var es_anchor_Anchor = anchor_Anchor;
|
|
es_anchor_Anchor.Link = anchor_AnchorLink;
|
|
/* harmony default export */ var es_anchor = (es_anchor_Anchor);
|
|
|
|
/***/ }),
|
|
|
|
/***/ 74131:
|
|
/*!****************************************************************!*\
|
|
!*** ./node_modules/antd/es/anchor/style/index.js + 1 modules ***!
|
|
\****************************************************************/
|
|
/***/ (function(__unused_webpack_module, __unused_webpack___webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/style/default.less
|
|
var style_default = __webpack_require__(43146);
|
|
;// CONCATENATED MODULE: ./node_modules/antd/es/anchor/style/index.less
|
|
// extracted by mini-css-extract-plugin
|
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/affix/style/index.js + 1 modules
|
|
var style = __webpack_require__(48283);
|
|
;// CONCATENATED MODULE: ./node_modules/antd/es/anchor/style/index.js
|
|
|
|
|
|
// style dependencies
|
|
|
|
|
|
/***/ })
|
|
|
|
}]); |