first commit
This commit is contained in:
14
frontend/node_modules/antd/es/back-top/index.d.ts
generated
vendored
Normal file
14
frontend/node_modules/antd/es/back-top/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
import * as React from 'react';
|
||||
export interface BackTopProps {
|
||||
visibilityHeight?: number;
|
||||
onClick?: React.MouseEventHandler<HTMLElement>;
|
||||
target?: () => HTMLElement | Window | Document;
|
||||
prefixCls?: string;
|
||||
children?: React.ReactNode;
|
||||
className?: string;
|
||||
rootClassName?: string;
|
||||
style?: React.CSSProperties;
|
||||
duration?: number;
|
||||
}
|
||||
declare const BackTop: React.FC<BackTopProps>;
|
||||
export default BackTop;
|
||||
93
frontend/node_modules/antd/es/back-top/index.js
generated
vendored
Normal file
93
frontend/node_modules/antd/es/back-top/index.js
generated
vendored
Normal file
@@ -0,0 +1,93 @@
|
||||
"use client";
|
||||
|
||||
import * as React from 'react';
|
||||
import VerticalAlignTopOutlined from "@ant-design/icons/es/icons/VerticalAlignTopOutlined";
|
||||
import classNames from 'classnames';
|
||||
import CSSMotion from 'rc-motion';
|
||||
import omit from "rc-util/es/omit";
|
||||
import getScroll from '../_util/getScroll';
|
||||
import { cloneElement } from '../_util/reactNode';
|
||||
import scrollTo from '../_util/scrollTo';
|
||||
import throttleByAnimationFrame from '../_util/throttleByAnimationFrame';
|
||||
import { devUseWarning } from '../_util/warning';
|
||||
import { ConfigContext } from '../config-provider';
|
||||
import useStyle from './style';
|
||||
const BackTop = props => {
|
||||
const {
|
||||
prefixCls: customizePrefixCls,
|
||||
className,
|
||||
rootClassName,
|
||||
visibilityHeight = 400,
|
||||
target,
|
||||
onClick,
|
||||
duration = 450
|
||||
} = props;
|
||||
const [visible, setVisible] = React.useState(visibilityHeight === 0);
|
||||
const ref = React.useRef(null);
|
||||
const getDefaultTarget = () => {
|
||||
var _a;
|
||||
return ((_a = ref.current) === null || _a === void 0 ? void 0 : _a.ownerDocument) || window;
|
||||
};
|
||||
const handleScroll = throttleByAnimationFrame(e => {
|
||||
const scrollTop = getScroll(e.target);
|
||||
setVisible(scrollTop >= visibilityHeight);
|
||||
});
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
const warning = devUseWarning('BackTop');
|
||||
warning.deprecated(false, 'BackTop', 'FloatButton.BackTop');
|
||||
}
|
||||
React.useEffect(() => {
|
||||
const getTarget = target || getDefaultTarget;
|
||||
const container = getTarget();
|
||||
handleScroll({
|
||||
target: container
|
||||
});
|
||||
container === null || container === void 0 ? void 0 : container.addEventListener('scroll', handleScroll);
|
||||
return () => {
|
||||
handleScroll.cancel();
|
||||
container === null || container === void 0 ? void 0 : container.removeEventListener('scroll', handleScroll);
|
||||
};
|
||||
}, [target]);
|
||||
const scrollToTop = e => {
|
||||
scrollTo(0, {
|
||||
getContainer: target || getDefaultTarget,
|
||||
duration
|
||||
});
|
||||
onClick === null || onClick === void 0 ? void 0 : onClick(e);
|
||||
};
|
||||
const {
|
||||
getPrefixCls,
|
||||
direction
|
||||
} = React.useContext(ConfigContext);
|
||||
const prefixCls = getPrefixCls('back-top', customizePrefixCls);
|
||||
const rootPrefixCls = getPrefixCls();
|
||||
const [wrapCSSVar, hashId, cssVarCls] = useStyle(prefixCls);
|
||||
const classString = classNames(hashId, cssVarCls, prefixCls, {
|
||||
[`${prefixCls}-rtl`]: direction === 'rtl'
|
||||
}, className, rootClassName);
|
||||
// fix https://fb.me/react-unknown-prop
|
||||
const divProps = omit(props, ['prefixCls', 'className', 'rootClassName', 'children', 'visibilityHeight', 'target']);
|
||||
const defaultElement = /*#__PURE__*/React.createElement("div", {
|
||||
className: `${prefixCls}-content`
|
||||
}, /*#__PURE__*/React.createElement("div", {
|
||||
className: `${prefixCls}-icon`
|
||||
}, /*#__PURE__*/React.createElement(VerticalAlignTopOutlined, null)));
|
||||
return wrapCSSVar(/*#__PURE__*/React.createElement("div", Object.assign({}, divProps, {
|
||||
className: classString,
|
||||
onClick: scrollToTop,
|
||||
ref: ref
|
||||
}), /*#__PURE__*/React.createElement(CSSMotion, {
|
||||
visible: visible,
|
||||
motionName: `${rootPrefixCls}-fade`
|
||||
}, ({
|
||||
className: motionClassName
|
||||
}) => cloneElement(props.children || defaultElement, ({
|
||||
className: cloneCls
|
||||
}) => ({
|
||||
className: classNames(motionClassName, cloneCls)
|
||||
})))));
|
||||
};
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
BackTop.displayName = 'BackTop';
|
||||
}
|
||||
export default BackTop;
|
||||
12
frontend/node_modules/antd/es/back-top/style/index.d.ts
generated
vendored
Normal file
12
frontend/node_modules/antd/es/back-top/style/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
import type { GetDefaultToken } from '../../theme/internal';
|
||||
/** Component only token. Which will handle additional calculation of alias token */
|
||||
export interface ComponentToken {
|
||||
/**
|
||||
* @desc 弹出层的 z-index
|
||||
* @descEN z-index of popup
|
||||
*/
|
||||
zIndexPopup: number;
|
||||
}
|
||||
export declare const prepareComponentToken: GetDefaultToken<'BackTop'>;
|
||||
declare const _default: (prefixCls: string, rootCls?: string) => readonly [(node: React.ReactElement) => React.ReactElement, string, string];
|
||||
export default _default;
|
||||
92
frontend/node_modules/antd/es/back-top/style/index.js
generated
vendored
Normal file
92
frontend/node_modules/antd/es/back-top/style/index.js
generated
vendored
Normal file
@@ -0,0 +1,92 @@
|
||||
import { unit } from '@ant-design/cssinjs';
|
||||
import { resetComponent } from '../../style';
|
||||
import { genStyleHooks, mergeToken } from '../../theme/internal';
|
||||
// ============================== Shared ==============================
|
||||
const genSharedBackTopStyle = token => {
|
||||
const {
|
||||
componentCls,
|
||||
backTopFontSize,
|
||||
backTopSize,
|
||||
zIndexPopup
|
||||
} = token;
|
||||
return {
|
||||
[componentCls]: Object.assign(Object.assign({}, resetComponent(token)), {
|
||||
position: 'fixed',
|
||||
insetInlineEnd: token.backTopInlineEnd,
|
||||
insetBlockEnd: token.backTopBlockEnd,
|
||||
zIndex: zIndexPopup,
|
||||
width: 40,
|
||||
height: 40,
|
||||
cursor: 'pointer',
|
||||
'&:empty': {
|
||||
display: 'none'
|
||||
},
|
||||
[`${componentCls}-content`]: {
|
||||
width: backTopSize,
|
||||
height: backTopSize,
|
||||
overflow: 'hidden',
|
||||
color: token.backTopColor,
|
||||
textAlign: 'center',
|
||||
backgroundColor: token.backTopBackground,
|
||||
borderRadius: backTopSize,
|
||||
transition: `all ${token.motionDurationMid}`,
|
||||
'&:hover': {
|
||||
backgroundColor: token.backTopHoverBackground,
|
||||
transition: `all ${token.motionDurationMid}`
|
||||
}
|
||||
},
|
||||
// change to .backtop .backtop-icon
|
||||
[`${componentCls}-icon`]: {
|
||||
fontSize: backTopFontSize,
|
||||
lineHeight: unit(backTopSize)
|
||||
}
|
||||
})
|
||||
};
|
||||
};
|
||||
const genMediaBackTopStyle = token => {
|
||||
const {
|
||||
componentCls,
|
||||
screenMD,
|
||||
screenXS,
|
||||
backTopInlineEndMD,
|
||||
backTopInlineEndXS
|
||||
} = token;
|
||||
return {
|
||||
[`@media (max-width: ${unit(screenMD)})`]: {
|
||||
[componentCls]: {
|
||||
insetInlineEnd: backTopInlineEndMD
|
||||
}
|
||||
},
|
||||
[`@media (max-width: ${unit(screenXS)})`]: {
|
||||
[componentCls]: {
|
||||
insetInlineEnd: backTopInlineEndXS
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
export const prepareComponentToken = token => ({
|
||||
zIndexPopup: token.zIndexBase + 10
|
||||
});
|
||||
// ============================== Export ==============================
|
||||
export default genStyleHooks('BackTop', token => {
|
||||
const {
|
||||
fontSizeHeading3,
|
||||
colorTextDescription,
|
||||
colorTextLightSolid,
|
||||
colorText,
|
||||
controlHeightLG,
|
||||
calc
|
||||
} = token;
|
||||
const backTopToken = mergeToken(token, {
|
||||
backTopBackground: colorTextDescription,
|
||||
backTopColor: colorTextLightSolid,
|
||||
backTopHoverBackground: colorText,
|
||||
backTopFontSize: fontSizeHeading3,
|
||||
backTopSize: controlHeightLG,
|
||||
backTopBlockEnd: calc(controlHeightLG).mul(1.25).equal(),
|
||||
backTopInlineEnd: calc(controlHeightLG).mul(2.5).equal(),
|
||||
backTopInlineEndMD: calc(controlHeightLG).mul(1.5).equal(),
|
||||
backTopInlineEndXS: calc(controlHeightLG).mul(0.5).equal()
|
||||
});
|
||||
return [genSharedBackTopStyle(backTopToken), genMediaBackTopStyle(backTopToken)];
|
||||
}, prepareComponentToken);
|
||||
Reference in New Issue
Block a user