Latest updates from IceHrmPro
This commit is contained in:
81
web/node_modules/antd/es/anchor/Anchor.d.ts
generated
vendored
Normal file
81
web/node_modules/antd/es/anchor/Anchor.d.ts
generated
vendored
Normal file
@@ -0,0 +1,81 @@
|
||||
import * as React from 'react';
|
||||
import * as PropTypes from 'prop-types';
|
||||
import AnchorLink from './AnchorLink';
|
||||
import { ConfigConsumerProps } from '../config-provider';
|
||||
declare function getDefaultContainer(): Window & typeof globalThis;
|
||||
export declare type AnchorContainer = HTMLElement | Window;
|
||||
export interface AnchorProps {
|
||||
prefixCls?: string;
|
||||
className?: string;
|
||||
style?: React.CSSProperties;
|
||||
children?: React.ReactNode;
|
||||
offsetTop?: number;
|
||||
bounds?: number;
|
||||
affix?: boolean;
|
||||
showInkInFixed?: boolean;
|
||||
getContainer?: () => AnchorContainer;
|
||||
/** Return customize highlight anchor */
|
||||
getCurrentAnchor?: () => string;
|
||||
onClick?: (e: React.MouseEvent<HTMLElement>, link: {
|
||||
title: React.ReactNode;
|
||||
href: string;
|
||||
}) => void;
|
||||
/** Scroll to target offset value, if none, it's offsetTop prop value or 0. */
|
||||
targetOffset?: number;
|
||||
/** Listening event when scrolling change active link */
|
||||
onChange?: (currentActiveLink: string) => void;
|
||||
}
|
||||
export interface AnchorState {
|
||||
activeLink: null | string;
|
||||
}
|
||||
export interface AnchorDefaultProps extends AnchorProps {
|
||||
prefixCls: string;
|
||||
affix: boolean;
|
||||
showInkInFixed: boolean;
|
||||
getContainer: () => AnchorContainer;
|
||||
}
|
||||
export interface AntAnchor {
|
||||
registerLink: (link: string) => void;
|
||||
unregisterLink: (link: string) => void;
|
||||
activeLink: string | null;
|
||||
scrollTo: (link: string) => void;
|
||||
onClick?: (e: React.MouseEvent<HTMLElement>, link: {
|
||||
title: React.ReactNode;
|
||||
href: string;
|
||||
}) => void;
|
||||
}
|
||||
export default class Anchor extends React.Component<AnchorProps, AnchorState> {
|
||||
static Link: typeof AnchorLink;
|
||||
static defaultProps: {
|
||||
affix: boolean;
|
||||
showInkInFixed: boolean;
|
||||
getContainer: typeof getDefaultContainer;
|
||||
};
|
||||
static childContextTypes: {
|
||||
antAnchor: PropTypes.Requireable<object>;
|
||||
};
|
||||
state: {
|
||||
activeLink: null;
|
||||
};
|
||||
private inkNode;
|
||||
private scrollContainer;
|
||||
private links;
|
||||
private scrollEvent;
|
||||
private animating;
|
||||
private prefixCls?;
|
||||
getChildContext(): {
|
||||
antAnchor: AntAnchor;
|
||||
};
|
||||
componentDidMount(): void;
|
||||
componentDidUpdate(): void;
|
||||
componentWillUnmount(): void;
|
||||
getCurrentAnchor(offsetTop?: number, bounds?: number): string;
|
||||
handleScrollTo: (link: string) => void;
|
||||
saveInkNode: (node: HTMLSpanElement) => void;
|
||||
setCurrentActiveLink: (link: string) => void;
|
||||
handleScroll: () => void;
|
||||
updateInk: () => void;
|
||||
renderAnchor: ({ getPrefixCls, direction }: ConfigConsumerProps) => JSX.Element;
|
||||
render(): JSX.Element;
|
||||
}
|
||||
export {};
|
||||
343
web/node_modules/antd/es/anchor/Anchor.js
generated
vendored
Normal file
343
web/node_modules/antd/es/anchor/Anchor.js
generated
vendored
Normal file
@@ -0,0 +1,343 @@
|
||||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
||||
|
||||
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
||||
|
||||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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); } }
|
||||
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
||||
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
|
||||
function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
||||
|
||||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
||||
|
||||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
||||
|
||||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
||||
|
||||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
||||
|
||||
import * as React from 'react';
|
||||
import * as ReactDOM from 'react-dom';
|
||||
import * as PropTypes from 'prop-types';
|
||||
import classNames from 'classnames';
|
||||
import addEventListener from "rc-util/es/Dom/addEventListener";
|
||||
import Affix from '../affix';
|
||||
import { ConfigConsumer } from '../config-provider';
|
||||
import scrollTo from '../_util/scrollTo';
|
||||
import getScroll from '../_util/getScroll';
|
||||
|
||||
function getDefaultContainer() {
|
||||
return window;
|
||||
}
|
||||
|
||||
function getOffsetTop(element, container) {
|
||||
if (!element) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
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 = /#([^#]+)$/;
|
||||
|
||||
var Anchor = /*#__PURE__*/function (_React$Component) {
|
||||
_inherits(Anchor, _React$Component);
|
||||
|
||||
var _super = _createSuper(Anchor);
|
||||
|
||||
function Anchor() {
|
||||
var _this;
|
||||
|
||||
_classCallCheck(this, Anchor);
|
||||
|
||||
_this = _super.apply(this, arguments);
|
||||
_this.state = {
|
||||
activeLink: null
|
||||
};
|
||||
_this.links = [];
|
||||
|
||||
_this.handleScrollTo = function (link) {
|
||||
var _this$props = _this.props,
|
||||
offsetTop = _this$props.offsetTop,
|
||||
getContainer = _this$props.getContainer,
|
||||
targetOffset = _this$props.targetOffset;
|
||||
|
||||
_this.setCurrentActiveLink(link);
|
||||
|
||||
var container = getContainer();
|
||||
var scrollTop = getScroll(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;
|
||||
_this.animating = true;
|
||||
scrollTo(y, {
|
||||
callback: function callback() {
|
||||
_this.animating = false;
|
||||
},
|
||||
getContainer: getContainer
|
||||
});
|
||||
};
|
||||
|
||||
_this.saveInkNode = function (node) {
|
||||
_this.inkNode = node;
|
||||
};
|
||||
|
||||
_this.setCurrentActiveLink = function (link) {
|
||||
var activeLink = _this.state.activeLink;
|
||||
var onChange = _this.props.onChange;
|
||||
|
||||
if (activeLink !== link) {
|
||||
_this.setState({
|
||||
activeLink: link
|
||||
});
|
||||
|
||||
if (onChange) {
|
||||
onChange(link);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
_this.handleScroll = function () {
|
||||
if (_this.animating) {
|
||||
return;
|
||||
}
|
||||
|
||||
var _this$props2 = _this.props,
|
||||
offsetTop = _this$props2.offsetTop,
|
||||
bounds = _this$props2.bounds,
|
||||
targetOffset = _this$props2.targetOffset;
|
||||
|
||||
var currentActiveLink = _this.getCurrentAnchor(targetOffset !== undefined ? targetOffset : offsetTop || 0, bounds);
|
||||
|
||||
_this.setCurrentActiveLink(currentActiveLink);
|
||||
};
|
||||
|
||||
_this.updateInk = function () {
|
||||
if (typeof document === 'undefined') {
|
||||
return;
|
||||
}
|
||||
|
||||
var _assertThisInitialize = _assertThisInitialized(_this),
|
||||
prefixCls = _assertThisInitialize.prefixCls;
|
||||
|
||||
var anchorNode = ReactDOM.findDOMNode(_assertThisInitialized(_this));
|
||||
var linkNode = anchorNode.getElementsByClassName("".concat(prefixCls, "-link-title-active"))[0];
|
||||
|
||||
if (linkNode) {
|
||||
_this.inkNode.style.top = "".concat(linkNode.offsetTop + linkNode.clientHeight / 2 - 4.5, "px");
|
||||
}
|
||||
};
|
||||
|
||||
_this.renderAnchor = function (_ref) {
|
||||
var getPrefixCls = _ref.getPrefixCls,
|
||||
direction = _ref.direction;
|
||||
var _this$props3 = _this.props,
|
||||
customizePrefixCls = _this$props3.prefixCls,
|
||||
_this$props3$classNam = _this$props3.className,
|
||||
className = _this$props3$classNam === void 0 ? '' : _this$props3$classNam,
|
||||
style = _this$props3.style,
|
||||
offsetTop = _this$props3.offsetTop,
|
||||
affix = _this$props3.affix,
|
||||
showInkInFixed = _this$props3.showInkInFixed,
|
||||
children = _this$props3.children,
|
||||
getContainer = _this$props3.getContainer;
|
||||
var activeLink = _this.state.activeLink;
|
||||
var prefixCls = getPrefixCls('anchor', customizePrefixCls); // To support old version react.
|
||||
// Have to add prefixCls on the instance.
|
||||
// https://github.com/facebook/react/issues/12397
|
||||
|
||||
_this.prefixCls = prefixCls;
|
||||
var inkClass = classNames("".concat(prefixCls, "-ink-ball"), {
|
||||
visible: activeLink
|
||||
});
|
||||
var wrapperClass = classNames(className, "".concat(prefixCls, "-wrapper"), _defineProperty({}, "".concat(prefixCls, "-rtl"), direction === 'rtl'));
|
||||
var anchorClass = classNames(prefixCls, {
|
||||
fixed: !affix && !showInkInFixed
|
||||
});
|
||||
|
||||
var wrapperStyle = _extends({
|
||||
maxHeight: offsetTop ? "calc(100vh - ".concat(offsetTop, "px)") : '100vh'
|
||||
}, style);
|
||||
|
||||
var anchorContent = /*#__PURE__*/React.createElement("div", {
|
||||
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: _this.saveInkNode
|
||||
})), children));
|
||||
return !affix ? anchorContent : /*#__PURE__*/React.createElement(Affix, {
|
||||
offsetTop: offsetTop,
|
||||
target: getContainer
|
||||
}, anchorContent);
|
||||
};
|
||||
|
||||
return _this;
|
||||
}
|
||||
|
||||
_createClass(Anchor, [{
|
||||
key: "getChildContext",
|
||||
value: function getChildContext() {
|
||||
var _this2 = this;
|
||||
|
||||
var antAnchor = {
|
||||
registerLink: function registerLink(link) {
|
||||
if (!_this2.links.includes(link)) {
|
||||
_this2.links.push(link);
|
||||
}
|
||||
},
|
||||
unregisterLink: function unregisterLink(link) {
|
||||
var index = _this2.links.indexOf(link);
|
||||
|
||||
if (index !== -1) {
|
||||
_this2.links.splice(index, 1);
|
||||
}
|
||||
},
|
||||
activeLink: this.state.activeLink,
|
||||
scrollTo: this.handleScrollTo,
|
||||
onClick: this.props.onClick
|
||||
};
|
||||
return {
|
||||
antAnchor: antAnchor
|
||||
};
|
||||
}
|
||||
}, {
|
||||
key: "componentDidMount",
|
||||
value: function componentDidMount() {
|
||||
var getContainer = this.props.getContainer;
|
||||
this.scrollContainer = getContainer();
|
||||
this.scrollEvent = addEventListener(this.scrollContainer, 'scroll', this.handleScroll);
|
||||
this.handleScroll();
|
||||
}
|
||||
}, {
|
||||
key: "componentDidUpdate",
|
||||
value: function componentDidUpdate() {
|
||||
if (this.scrollEvent) {
|
||||
var getContainer = this.props.getContainer;
|
||||
var currentContainer = getContainer();
|
||||
|
||||
if (this.scrollContainer !== currentContainer) {
|
||||
this.scrollContainer = currentContainer;
|
||||
this.scrollEvent.remove();
|
||||
this.scrollEvent = addEventListener(this.scrollContainer, 'scroll', this.handleScroll);
|
||||
this.handleScroll();
|
||||
}
|
||||
}
|
||||
|
||||
this.updateInk();
|
||||
}
|
||||
}, {
|
||||
key: "componentWillUnmount",
|
||||
value: function componentWillUnmount() {
|
||||
if (this.scrollEvent) {
|
||||
this.scrollEvent.remove();
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "getCurrentAnchor",
|
||||
value: function getCurrentAnchor() {
|
||||
var offsetTop = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
||||
var bounds = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 5;
|
||||
var getCurrentAnchor = this.props.getCurrentAnchor;
|
||||
|
||||
if (typeof getCurrentAnchor === 'function') {
|
||||
return getCurrentAnchor();
|
||||
}
|
||||
|
||||
var activeLink = '';
|
||||
|
||||
if (typeof document === 'undefined') {
|
||||
return activeLink;
|
||||
}
|
||||
|
||||
var linkSections = [];
|
||||
var getContainer = this.props.getContainer;
|
||||
var container = getContainer();
|
||||
this.links.forEach(function (link) {
|
||||
var sharpLinkMatch = sharpMatcherRegx.exec(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 '';
|
||||
}
|
||||
}, {
|
||||
key: "render",
|
||||
value: function render() {
|
||||
return /*#__PURE__*/React.createElement(ConfigConsumer, null, this.renderAnchor);
|
||||
}
|
||||
}]);
|
||||
|
||||
return Anchor;
|
||||
}(React.Component);
|
||||
|
||||
export { Anchor as default };
|
||||
Anchor.defaultProps = {
|
||||
affix: true,
|
||||
showInkInFixed: false,
|
||||
getContainer: getDefaultContainer
|
||||
};
|
||||
Anchor.childContextTypes = {
|
||||
antAnchor: PropTypes.object
|
||||
};
|
||||
30
web/node_modules/antd/es/anchor/AnchorLink.d.ts
generated
vendored
Normal file
30
web/node_modules/antd/es/anchor/AnchorLink.d.ts
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
import * as React from 'react';
|
||||
import * as PropTypes from 'prop-types';
|
||||
import { AntAnchor } from './Anchor';
|
||||
import { ConfigConsumerProps } from '../config-provider';
|
||||
export interface AnchorLinkProps {
|
||||
prefixCls?: string;
|
||||
href: string;
|
||||
target?: string;
|
||||
title: React.ReactNode;
|
||||
children?: React.ReactNode;
|
||||
className?: string;
|
||||
}
|
||||
declare class AnchorLink extends React.Component<AnchorLinkProps, any> {
|
||||
static defaultProps: {
|
||||
href: string;
|
||||
};
|
||||
static contextTypes: {
|
||||
antAnchor: PropTypes.Requireable<object>;
|
||||
};
|
||||
context: {
|
||||
antAnchor: AntAnchor;
|
||||
};
|
||||
componentDidMount(): void;
|
||||
componentDidUpdate({ href: prevHref }: AnchorLinkProps): void;
|
||||
componentWillUnmount(): void;
|
||||
handleClick: (e: React.MouseEvent<HTMLElement, MouseEvent>) => void;
|
||||
renderAnchorLink: ({ getPrefixCls }: ConfigConsumerProps) => JSX.Element;
|
||||
render(): JSX.Element;
|
||||
}
|
||||
export default AnchorLink;
|
||||
124
web/node_modules/antd/es/anchor/AnchorLink.js
generated
vendored
Normal file
124
web/node_modules/antd/es/anchor/AnchorLink.js
generated
vendored
Normal file
@@ -0,0 +1,124 @@
|
||||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
||||
|
||||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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); } }
|
||||
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
||||
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
|
||||
function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
||||
|
||||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
||||
|
||||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
||||
|
||||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
||||
|
||||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
||||
|
||||
import * as React from 'react';
|
||||
import * as PropTypes from 'prop-types';
|
||||
import classNames from 'classnames';
|
||||
import { ConfigConsumer } from '../config-provider';
|
||||
|
||||
var AnchorLink = /*#__PURE__*/function (_React$Component) {
|
||||
_inherits(AnchorLink, _React$Component);
|
||||
|
||||
var _super = _createSuper(AnchorLink);
|
||||
|
||||
function AnchorLink() {
|
||||
var _this;
|
||||
|
||||
_classCallCheck(this, AnchorLink);
|
||||
|
||||
_this = _super.apply(this, arguments);
|
||||
|
||||
_this.handleClick = function (e) {
|
||||
var _this$context$antAnch = _this.context.antAnchor,
|
||||
scrollTo = _this$context$antAnch.scrollTo,
|
||||
onClick = _this$context$antAnch.onClick;
|
||||
var _this$props = _this.props,
|
||||
href = _this$props.href,
|
||||
title = _this$props.title;
|
||||
|
||||
if (onClick) {
|
||||
onClick(e, {
|
||||
title: title,
|
||||
href: href
|
||||
});
|
||||
}
|
||||
|
||||
scrollTo(href);
|
||||
};
|
||||
|
||||
_this.renderAnchorLink = function (_ref) {
|
||||
var getPrefixCls = _ref.getPrefixCls;
|
||||
var _this$props2 = _this.props,
|
||||
customizePrefixCls = _this$props2.prefixCls,
|
||||
href = _this$props2.href,
|
||||
title = _this$props2.title,
|
||||
children = _this$props2.children,
|
||||
className = _this$props2.className,
|
||||
target = _this$props2.target;
|
||||
var prefixCls = getPrefixCls('anchor', customizePrefixCls);
|
||||
var active = _this.context.antAnchor.activeLink === href;
|
||||
var wrapperClassName = classNames(className, "".concat(prefixCls, "-link"), _defineProperty({}, "".concat(prefixCls, "-link-active"), active));
|
||||
var titleClassName = classNames("".concat(prefixCls, "-link-title"), _defineProperty({}, "".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: _this.handleClick
|
||||
}, title), children);
|
||||
};
|
||||
|
||||
return _this;
|
||||
}
|
||||
|
||||
_createClass(AnchorLink, [{
|
||||
key: "componentDidMount",
|
||||
value: function componentDidMount() {
|
||||
this.context.antAnchor.registerLink(this.props.href);
|
||||
}
|
||||
}, {
|
||||
key: "componentDidUpdate",
|
||||
value: function componentDidUpdate(_ref2) {
|
||||
var prevHref = _ref2.href;
|
||||
var href = this.props.href;
|
||||
|
||||
if (prevHref !== href) {
|
||||
this.context.antAnchor.unregisterLink(prevHref);
|
||||
this.context.antAnchor.registerLink(href);
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "componentWillUnmount",
|
||||
value: function componentWillUnmount() {
|
||||
this.context.antAnchor.unregisterLink(this.props.href);
|
||||
}
|
||||
}, {
|
||||
key: "render",
|
||||
value: function render() {
|
||||
return /*#__PURE__*/React.createElement(ConfigConsumer, null, this.renderAnchorLink);
|
||||
}
|
||||
}]);
|
||||
|
||||
return AnchorLink;
|
||||
}(React.Component);
|
||||
|
||||
AnchorLink.defaultProps = {
|
||||
href: '#'
|
||||
};
|
||||
AnchorLink.contextTypes = {
|
||||
antAnchor: PropTypes.object
|
||||
};
|
||||
export default AnchorLink;
|
||||
4
web/node_modules/antd/es/anchor/index.d.ts
generated
vendored
Normal file
4
web/node_modules/antd/es/anchor/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
import Anchor from './Anchor';
|
||||
export { AnchorProps } from './Anchor';
|
||||
export { AnchorLinkProps } from './AnchorLink';
|
||||
export default Anchor;
|
||||
4
web/node_modules/antd/es/anchor/index.js
generated
vendored
Normal file
4
web/node_modules/antd/es/anchor/index.js
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
import Anchor from './Anchor';
|
||||
import AnchorLink from './AnchorLink';
|
||||
Anchor.Link = AnchorLink;
|
||||
export default Anchor;
|
||||
4
web/node_modules/antd/es/anchor/style/css.js
generated
vendored
Normal file
4
web/node_modules/antd/es/anchor/style/css.js
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
import '../../style/index.css';
|
||||
import './index.css'; // style dependencies
|
||||
|
||||
import '../../affix/style/css';
|
||||
107
web/node_modules/antd/es/anchor/style/index.css
generated
vendored
Normal file
107
web/node_modules/antd/es/anchor/style/index.css
generated
vendored
Normal file
@@ -0,0 +1,107 @@
|
||||
/* stylelint-disable at-rule-empty-line-before,at-rule-name-space-after,at-rule-no-unknown */
|
||||
/* stylelint-disable no-duplicate-selectors */
|
||||
/* stylelint-disable */
|
||||
/* stylelint-disable declaration-bang-space-before,no-duplicate-selectors,string-no-newline */
|
||||
.ant-anchor {
|
||||
-webkit-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
color: rgba(0, 0, 0, 0.65);
|
||||
font-size: 14px;
|
||||
font-variant: tabular-nums;
|
||||
line-height: 1.5715;
|
||||
list-style: none;
|
||||
-webkit-font-feature-settings: 'tnum';
|
||||
font-feature-settings: 'tnum';
|
||||
position: relative;
|
||||
padding-left: 2px;
|
||||
}
|
||||
.ant-anchor-wrapper {
|
||||
margin-left: -4px;
|
||||
padding-left: 4px;
|
||||
overflow: auto;
|
||||
background-color: #fff;
|
||||
}
|
||||
.ant-anchor-ink {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
height: 100%;
|
||||
}
|
||||
.ant-anchor-ink::before {
|
||||
position: relative;
|
||||
display: block;
|
||||
width: 2px;
|
||||
height: 100%;
|
||||
margin: 0 auto;
|
||||
background-color: #f0f0f0;
|
||||
content: ' ';
|
||||
}
|
||||
.ant-anchor-ink-ball {
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
display: none;
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
background-color: #fff;
|
||||
border: 2px solid #1890ff;
|
||||
border-radius: 8px;
|
||||
-webkit-transform: translateX(-50%);
|
||||
transform: translateX(-50%);
|
||||
-webkit-transition: top 0.3s ease-in-out;
|
||||
transition: top 0.3s ease-in-out;
|
||||
}
|
||||
.ant-anchor-ink-ball.visible {
|
||||
display: inline-block;
|
||||
}
|
||||
.ant-anchor.fixed .ant-anchor-ink .ant-anchor-ink-ball {
|
||||
display: none;
|
||||
}
|
||||
.ant-anchor-link {
|
||||
padding: 7px 0 7px 16px;
|
||||
line-height: 1.143;
|
||||
}
|
||||
.ant-anchor-link-title {
|
||||
position: relative;
|
||||
display: block;
|
||||
margin-bottom: 6px;
|
||||
overflow: hidden;
|
||||
color: rgba(0, 0, 0, 0.65);
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
-webkit-transition: all 0.3s;
|
||||
transition: all 0.3s;
|
||||
}
|
||||
.ant-anchor-link-title:only-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.ant-anchor-link-active > .ant-anchor-link-title {
|
||||
color: #1890ff;
|
||||
}
|
||||
.ant-anchor-link .ant-anchor-link {
|
||||
padding-top: 5px;
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
.ant-anchor-rtl {
|
||||
direction: rtl;
|
||||
}
|
||||
.ant-anchor-rtl.ant-anchor-wrapper {
|
||||
margin-right: -4px;
|
||||
margin-left: 0;
|
||||
padding-right: 4px;
|
||||
padding-left: 0;
|
||||
}
|
||||
.ant-anchor-rtl .ant-anchor-ink {
|
||||
right: 0;
|
||||
left: auto;
|
||||
}
|
||||
.ant-anchor-rtl .ant-anchor-ink-ball {
|
||||
right: 50%;
|
||||
left: 0;
|
||||
-webkit-transform: translateX(50%);
|
||||
transform: translateX(50%);
|
||||
}
|
||||
.ant-anchor-rtl .ant-anchor-link {
|
||||
padding: 7px 16px 7px 0;
|
||||
}
|
||||
3
web/node_modules/antd/es/anchor/style/index.d.ts
generated
vendored
Normal file
3
web/node_modules/antd/es/anchor/style/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import '../../style/index.less';
|
||||
import './index.less';
|
||||
import '../../affix/style';
|
||||
4
web/node_modules/antd/es/anchor/style/index.js
generated
vendored
Normal file
4
web/node_modules/antd/es/anchor/style/index.js
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
import '../../style/index.less';
|
||||
import './index.less'; // style dependencies
|
||||
|
||||
import '../../affix/style';
|
||||
84
web/node_modules/antd/es/anchor/style/index.less
generated
vendored
Normal file
84
web/node_modules/antd/es/anchor/style/index.less
generated
vendored
Normal file
@@ -0,0 +1,84 @@
|
||||
@import '../../style/themes/index';
|
||||
@import '../../style/mixins/index';
|
||||
|
||||
@anchor-border-width: 2px;
|
||||
|
||||
.@{ant-prefix}-anchor {
|
||||
.reset-component;
|
||||
|
||||
position: relative;
|
||||
padding-left: @anchor-border-width;
|
||||
|
||||
&-wrapper {
|
||||
margin-left: -4px;
|
||||
padding-left: 4px;
|
||||
overflow: auto;
|
||||
background-color: @anchor-bg;
|
||||
}
|
||||
|
||||
&-ink {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
height: 100%;
|
||||
&::before {
|
||||
position: relative;
|
||||
display: block;
|
||||
width: @anchor-border-width;
|
||||
height: 100%;
|
||||
margin: 0 auto;
|
||||
background-color: @anchor-border-color;
|
||||
content: ' ';
|
||||
}
|
||||
&-ball {
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
display: none;
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
background-color: @component-background;
|
||||
border: 2px solid @primary-color;
|
||||
border-radius: 8px;
|
||||
transform: translateX(-50%);
|
||||
transition: top 0.3s ease-in-out;
|
||||
&.visible {
|
||||
display: inline-block;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.fixed &-ink &-ink-ball {
|
||||
display: none;
|
||||
}
|
||||
|
||||
&-link {
|
||||
padding: 7px 0 7px 16px;
|
||||
line-height: 1.143;
|
||||
|
||||
&-title {
|
||||
position: relative;
|
||||
display: block;
|
||||
margin-bottom: 6px;
|
||||
overflow: hidden;
|
||||
color: @text-color;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
transition: all 0.3s;
|
||||
|
||||
&:only-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
&-active > &-title {
|
||||
color: @primary-color;
|
||||
}
|
||||
}
|
||||
|
||||
&-link &-link {
|
||||
padding-top: 5px;
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
}
|
||||
|
||||
@import './rtl';
|
||||
40
web/node_modules/antd/es/anchor/style/rtl.less
generated
vendored
Normal file
40
web/node_modules/antd/es/anchor/style/rtl.less
generated
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
@import '../../style/themes/index';
|
||||
@import '../../style/mixins/index';
|
||||
|
||||
@anchor-border-width: 2px;
|
||||
|
||||
.@{ant-prefix}-anchor {
|
||||
&-rtl {
|
||||
direction: rtl;
|
||||
}
|
||||
|
||||
&-wrapper {
|
||||
.@{ant-prefix}-anchor-rtl& {
|
||||
margin-right: -4px;
|
||||
margin-left: 0;
|
||||
padding-right: 4px;
|
||||
padding-left: 0;
|
||||
}
|
||||
}
|
||||
|
||||
&-ink {
|
||||
.@{ant-prefix}-anchor-rtl & {
|
||||
right: 0;
|
||||
left: auto;
|
||||
}
|
||||
|
||||
&-ball {
|
||||
.@{ant-prefix}-anchor-rtl & {
|
||||
right: 50%;
|
||||
left: 0;
|
||||
transform: translateX(50%);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&-link {
|
||||
.@{ant-prefix}-anchor-rtl & {
|
||||
padding: 7px 16px 7px 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user