add all frontend files

This commit is contained in:
2026-01-17 15:16:36 -05:00
parent ff16ae7858
commit e40287e4aa
25704 changed files with 1935289 additions and 0 deletions

13
node_modules/antd/es/typography/Base/CopyBtn.d.ts generated vendored Normal file
View File

@@ -0,0 +1,13 @@
import * as React from 'react';
import type { CopyConfig } from '.';
import type { Locale } from '../../locale';
export interface CopyBtnProps extends Omit<CopyConfig, 'onCopy'> {
prefixCls: string;
copied: boolean;
locale: Locale['Text'];
onCopy: React.MouseEventHandler<HTMLButtonElement>;
iconOnly: boolean;
loading: boolean;
}
declare const CopyBtn: React.FC<CopyBtnProps>;
export default CopyBtn;

43
node_modules/antd/es/typography/Base/CopyBtn.js generated vendored Normal file
View File

@@ -0,0 +1,43 @@
"use client";
import * as React from 'react';
import CheckOutlined from "@ant-design/icons/es/icons/CheckOutlined";
import CopyOutlined from "@ant-design/icons/es/icons/CopyOutlined";
import LoadingOutlined from "@ant-design/icons/es/icons/LoadingOutlined";
import classNames from 'classnames';
import Tooltip from '../../tooltip';
import { getNode, toList } from './util';
const CopyBtn = ({
prefixCls,
copied,
locale,
iconOnly,
tooltips,
icon,
tabIndex,
onCopy,
loading: btnLoading
}) => {
const tooltipNodes = toList(tooltips);
const iconNodes = toList(icon);
const {
copied: copiedText,
copy: copyText
} = locale !== null && locale !== void 0 ? locale : {};
const systemStr = copied ? copiedText : copyText;
const copyTitle = getNode(tooltipNodes[copied ? 1 : 0], systemStr);
const ariaLabel = typeof copyTitle === 'string' ? copyTitle : systemStr;
return /*#__PURE__*/React.createElement(Tooltip, {
title: copyTitle
}, /*#__PURE__*/React.createElement("button", {
type: "button",
className: classNames(`${prefixCls}-copy`, {
[`${prefixCls}-copy-success`]: copied,
[`${prefixCls}-copy-icon-only`]: iconOnly
}),
onClick: onCopy,
"aria-label": ariaLabel,
tabIndex: tabIndex
}, copied ? getNode(iconNodes[1], /*#__PURE__*/React.createElement(CheckOutlined, null), true) : getNode(iconNodes[0], btnLoading ? /*#__PURE__*/React.createElement(LoadingOutlined, null) : /*#__PURE__*/React.createElement(CopyOutlined, null), true)));
};
export default CopyBtn;

18
node_modules/antd/es/typography/Base/Ellipsis.d.ts generated vendored Normal file
View File

@@ -0,0 +1,18 @@
import * as React from 'react';
export interface EllipsisProps {
enableMeasure?: boolean;
text?: React.ReactNode;
width: number;
rows: number;
children: (cutChildren: React.ReactNode[],
/** Tell current `text` is exceed the `rows` which can be ellipsis */
canEllipsis: boolean) => React.ReactNode;
onEllipsis: (isEllipsis: boolean) => void;
expanded: boolean;
/**
* Mark for misc update. Which will not affect ellipsis content length.
* e.g. tooltip content update.
*/
miscDeps: any[];
}
export default function EllipsisMeasure(props: EllipsisProps): React.JSX.Element;

200
node_modules/antd/es/typography/Base/Ellipsis.js generated vendored Normal file
View File

@@ -0,0 +1,200 @@
"use client";
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
import * as React from 'react';
import toArray from "rc-util/es/Children/toArray";
import useLayoutEffect from "rc-util/es/hooks/useLayoutEffect";
import { isValidText } from './util';
const MeasureText = /*#__PURE__*/React.forwardRef(({
style,
children
}, ref) => {
const spanRef = React.useRef(null);
React.useImperativeHandle(ref, () => ({
isExceed: () => {
const span = spanRef.current;
return span.scrollHeight > span.clientHeight;
},
getHeight: () => spanRef.current.clientHeight
}));
return /*#__PURE__*/React.createElement("span", {
"aria-hidden": true,
ref: spanRef,
style: Object.assign({
position: 'fixed',
display: 'block',
left: 0,
top: 0,
pointerEvents: 'none',
backgroundColor: 'rgba(255, 0, 0, 0.65)'
}, style)
}, children);
});
const getNodesLen = nodeList => nodeList.reduce((totalLen, node) => totalLen + (isValidText(node) ? String(node).length : 1), 0);
function sliceNodes(nodeList, len) {
let currLen = 0;
const currentNodeList = [];
for (let i = 0; i < nodeList.length; i += 1) {
// Match to return
if (currLen === len) {
return currentNodeList;
}
const node = nodeList[i];
const canCut = isValidText(node);
const nodeLen = canCut ? String(node).length : 1;
const nextLen = currLen + nodeLen;
// Exceed but current not which means we need cut this
// This will not happen on validate ReactElement
if (nextLen > len) {
const restLen = len - currLen;
currentNodeList.push(String(node).slice(0, restLen));
return currentNodeList;
}
currentNodeList.push(node);
currLen = nextLen;
}
return nodeList;
}
// Measure for the `text` is exceed the `rows` or not
const STATUS_MEASURE_NONE = 0;
const STATUS_MEASURE_PREPARE = 1;
const STATUS_MEASURE_START = 2;
const STATUS_MEASURE_NEED_ELLIPSIS = 3;
const STATUS_MEASURE_NO_NEED_ELLIPSIS = 4;
const lineClipStyle = {
display: '-webkit-box',
overflow: 'hidden',
WebkitBoxOrient: 'vertical'
};
export default function EllipsisMeasure(props) {
const {
enableMeasure,
width,
text,
children,
rows,
expanded,
miscDeps,
onEllipsis
} = props;
const nodeList = React.useMemo(() => toArray(text), [text]);
const nodeLen = React.useMemo(() => getNodesLen(nodeList), [text]);
// ========================= Full Content =========================
// Used for measure only, which means it's always render as no need ellipsis
const fullContent = React.useMemo(() => children(nodeList, false), [text]);
// ========================= Cut Content ==========================
const [ellipsisCutIndex, setEllipsisCutIndex] = React.useState(null);
const cutMidRef = React.useRef(null);
// ========================= NeedEllipsis =========================
const measureWhiteSpaceRef = React.useRef(null);
const needEllipsisRef = React.useRef(null);
// Measure for `rows-1` height, to avoid operation exceed the line height
const descRowsEllipsisRef = React.useRef(null);
const symbolRowEllipsisRef = React.useRef(null);
const [canEllipsis, setCanEllipsis] = React.useState(false);
const [needEllipsis, setNeedEllipsis] = React.useState(STATUS_MEASURE_NONE);
const [ellipsisHeight, setEllipsisHeight] = React.useState(0);
const [parentWhiteSpace, setParentWhiteSpace] = React.useState(null);
// Trigger start measure
useLayoutEffect(() => {
if (enableMeasure && width && nodeLen) {
setNeedEllipsis(STATUS_MEASURE_PREPARE);
} else {
setNeedEllipsis(STATUS_MEASURE_NONE);
}
}, [width, text, rows, enableMeasure, nodeList]);
// Measure process
useLayoutEffect(() => {
var _a, _b, _c, _d;
if (needEllipsis === STATUS_MEASURE_PREPARE) {
setNeedEllipsis(STATUS_MEASURE_START);
// Parent ref `white-space`
const nextWhiteSpace = measureWhiteSpaceRef.current && getComputedStyle(measureWhiteSpaceRef.current).whiteSpace;
setParentWhiteSpace(nextWhiteSpace);
} else if (needEllipsis === STATUS_MEASURE_START) {
const isOverflow = !!((_a = needEllipsisRef.current) === null || _a === void 0 ? void 0 : _a.isExceed());
setNeedEllipsis(isOverflow ? STATUS_MEASURE_NEED_ELLIPSIS : STATUS_MEASURE_NO_NEED_ELLIPSIS);
setEllipsisCutIndex(isOverflow ? [0, nodeLen] : null);
setCanEllipsis(isOverflow);
// Get the basic height of ellipsis rows
const baseRowsEllipsisHeight = ((_b = needEllipsisRef.current) === null || _b === void 0 ? void 0 : _b.getHeight()) || 0;
// Get the height of `rows - 1` + symbol height
const descRowsEllipsisHeight = rows === 1 ? 0 : ((_c = descRowsEllipsisRef.current) === null || _c === void 0 ? void 0 : _c.getHeight()) || 0;
const symbolRowEllipsisHeight = ((_d = symbolRowEllipsisRef.current) === null || _d === void 0 ? void 0 : _d.getHeight()) || 0;
const maxRowsHeight = Math.max(baseRowsEllipsisHeight,
// height of rows with ellipsis
descRowsEllipsisHeight + symbolRowEllipsisHeight);
setEllipsisHeight(maxRowsHeight + 1);
onEllipsis(isOverflow);
}
}, [needEllipsis]);
// ========================= Cut Measure ==========================
const cutMidIndex = ellipsisCutIndex ? Math.ceil((ellipsisCutIndex[0] + ellipsisCutIndex[1]) / 2) : 0;
useLayoutEffect(() => {
var _a;
const [minIndex, maxIndex] = ellipsisCutIndex || [0, 0];
if (minIndex !== maxIndex) {
const midHeight = ((_a = cutMidRef.current) === null || _a === void 0 ? void 0 : _a.getHeight()) || 0;
const isOverflow = midHeight > ellipsisHeight;
let targetMidIndex = cutMidIndex;
if (maxIndex - minIndex === 1) {
targetMidIndex = isOverflow ? minIndex : maxIndex;
}
setEllipsisCutIndex(isOverflow ? [minIndex, targetMidIndex] : [targetMidIndex, maxIndex]);
}
}, [ellipsisCutIndex, cutMidIndex]);
// ========================= Text Content =========================
const finalContent = React.useMemo(() => {
// Skip everything if `enableMeasure` is disabled
if (!enableMeasure) {
return children(nodeList, false);
}
if (needEllipsis !== STATUS_MEASURE_NEED_ELLIPSIS || !ellipsisCutIndex || ellipsisCutIndex[0] !== ellipsisCutIndex[1]) {
const content = children(nodeList, false);
// Limit the max line count to avoid scrollbar blink unless no need ellipsis
// https://github.com/ant-design/ant-design/issues/42958
if ([STATUS_MEASURE_NO_NEED_ELLIPSIS, STATUS_MEASURE_NONE].includes(needEllipsis)) {
return content;
}
return /*#__PURE__*/React.createElement("span", {
style: Object.assign(Object.assign({}, lineClipStyle), {
WebkitLineClamp: rows
})
}, content);
}
return children(expanded ? nodeList : sliceNodes(nodeList, ellipsisCutIndex[0]), canEllipsis);
}, [expanded, needEllipsis, ellipsisCutIndex, nodeList].concat(_toConsumableArray(miscDeps)));
// ============================ Render ============================
const measureStyle = {
width,
margin: 0,
padding: 0,
whiteSpace: parentWhiteSpace === 'nowrap' ? 'normal' : 'inherit'
};
return /*#__PURE__*/React.createElement(React.Fragment, null, finalContent, needEllipsis === STATUS_MEASURE_START && (/*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(MeasureText, {
style: Object.assign(Object.assign(Object.assign({}, measureStyle), lineClipStyle), {
WebkitLineClamp: rows
}),
ref: needEllipsisRef
}, fullContent), /*#__PURE__*/React.createElement(MeasureText, {
style: Object.assign(Object.assign(Object.assign({}, measureStyle), lineClipStyle), {
WebkitLineClamp: rows - 1
}),
ref: descRowsEllipsisRef
}, fullContent), /*#__PURE__*/React.createElement(MeasureText, {
style: Object.assign(Object.assign(Object.assign({}, measureStyle), lineClipStyle), {
WebkitLineClamp: 1
}),
ref: symbolRowEllipsisRef
}, children([], true)))), needEllipsis === STATUS_MEASURE_NEED_ELLIPSIS && ellipsisCutIndex && ellipsisCutIndex[0] !== ellipsisCutIndex[1] && (/*#__PURE__*/React.createElement(MeasureText, {
style: Object.assign(Object.assign({}, measureStyle), {
top: 400
}),
ref: cutMidRef
}, children(sliceNodes(nodeList, cutMidIndex), true))), needEllipsis === STATUS_MEASURE_PREPARE && (/*#__PURE__*/React.createElement("span", {
style: {
whiteSpace: 'inherit'
},
ref: measureWhiteSpaceRef
})));
}

View File

@@ -0,0 +1,10 @@
import * as React from 'react';
import type { TooltipProps } from '../../tooltip';
export interface EllipsisTooltipProps {
tooltipProps?: TooltipProps;
enableEllipsis: boolean;
isEllipsis?: boolean;
children: React.ReactElement;
}
declare const EllipsisTooltip: React.FC<EllipsisTooltipProps>;
export default EllipsisTooltip;

View File

@@ -0,0 +1,21 @@
"use client";
import * as React from 'react';
import Tooltip from '../../tooltip';
const EllipsisTooltip = ({
enableEllipsis,
isEllipsis,
children,
tooltipProps
}) => {
if (!(tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.title) || !enableEllipsis) {
return children;
}
return /*#__PURE__*/React.createElement(Tooltip, Object.assign({
open: isEllipsis ? undefined : false
}, tooltipProps), children);
};
if (process.env.NODE_ENV !== 'production') {
EllipsisTooltip.displayName = 'EllipsisTooltip';
}
export default EllipsisTooltip;

59
node_modules/antd/es/typography/Base/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,59 @@
import * as React from 'react';
import type { JSX } from 'react';
import type { AutoSizeType } from 'rc-textarea';
import type { TooltipProps } from '../../tooltip';
import type { TypographyProps } from '../Typography';
export type BaseType = 'secondary' | 'success' | 'warning' | 'danger';
export interface CopyConfig {
text?: string | (() => string | Promise<string>);
onCopy?: (event?: React.MouseEvent<HTMLButtonElement>) => void;
icon?: React.ReactNode;
tooltips?: React.ReactNode;
format?: 'text/plain' | 'text/html';
tabIndex?: number;
}
interface EditConfig {
text?: string;
editing?: boolean;
icon?: React.ReactNode;
tooltip?: React.ReactNode;
onStart?: () => void;
onChange?: (value: string) => void;
onCancel?: () => void;
onEnd?: () => void;
maxLength?: number;
autoSize?: boolean | AutoSizeType;
triggerType?: ('icon' | 'text')[];
enterIcon?: React.ReactNode;
tabIndex?: number;
}
export interface EllipsisConfig {
rows?: number;
expandable?: boolean | 'collapsible';
suffix?: string;
symbol?: React.ReactNode | ((expanded: boolean) => React.ReactNode);
defaultExpanded?: boolean;
expanded?: boolean;
onExpand?: (e: React.MouseEvent<HTMLElement, MouseEvent>, info: {
expanded: boolean;
}) => void;
onEllipsis?: (ellipsis: boolean) => void;
tooltip?: React.ReactNode | TooltipProps;
}
export interface BlockProps<C extends keyof JSX.IntrinsicElements = keyof JSX.IntrinsicElements> extends TypographyProps<C> {
title?: string;
editable?: boolean | EditConfig;
copyable?: boolean | CopyConfig;
type?: BaseType;
disabled?: boolean;
ellipsis?: boolean | EllipsisConfig;
code?: boolean;
mark?: boolean;
underline?: boolean;
delete?: boolean;
strong?: boolean;
keyboard?: boolean;
italic?: boolean;
}
declare const Base: React.ForwardRefExoticComponent<BlockProps<keyof JSX.IntrinsicElements> & React.RefAttributes<HTMLElement>>;
export default Base;

359
node_modules/antd/es/typography/Base/index.js generated vendored Normal file
View File

@@ -0,0 +1,359 @@
"use client";
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
var __rest = this && this.__rest || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
import * as React from 'react';
import EditOutlined from "@ant-design/icons/es/icons/EditOutlined";
import classNames from 'classnames';
import ResizeObserver from 'rc-resize-observer';
import toArray from "rc-util/es/Children/toArray";
import useLayoutEffect from "rc-util/es/hooks/useLayoutEffect";
import useMergedState from "rc-util/es/hooks/useMergedState";
import omit from "rc-util/es/omit";
import { composeRef } from "rc-util/es/ref";
import { isStyleSupport } from '../../_util/styleChecker';
import { ConfigContext } from '../../config-provider';
import useLocale from '../../locale/useLocale';
import Tooltip from '../../tooltip';
import Editable from '../Editable';
import useCopyClick from '../hooks/useCopyClick';
import useMergedConfig from '../hooks/useMergedConfig';
import usePrevious from '../hooks/usePrevious';
import useTooltipProps from '../hooks/useTooltipProps';
import Typography from '../Typography';
import CopyBtn from './CopyBtn';
import Ellipsis from './Ellipsis';
import EllipsisTooltip from './EllipsisTooltip';
import { isEleEllipsis, isValidText } from './util';
function wrapperDecorations({
mark,
code,
underline,
delete: del,
strong,
keyboard,
italic
}, content) {
let currentContent = content;
function wrap(tag, needed) {
if (!needed) {
return;
}
currentContent = /*#__PURE__*/React.createElement(tag, {}, currentContent);
}
wrap('strong', strong);
wrap('u', underline);
wrap('del', del);
wrap('code', code);
wrap('mark', mark);
wrap('kbd', keyboard);
wrap('i', italic);
return currentContent;
}
const ELLIPSIS_STR = '...';
const DECORATION_PROPS = ['delete', 'mark', 'code', 'underline', 'strong', 'keyboard', 'italic'];
const Base = /*#__PURE__*/React.forwardRef((props, ref) => {
var _a;
const {
prefixCls: customizePrefixCls,
className,
style,
type,
disabled,
children,
ellipsis,
editable,
copyable,
component,
title
} = props,
restProps = __rest(props, ["prefixCls", "className", "style", "type", "disabled", "children", "ellipsis", "editable", "copyable", "component", "title"]);
const {
getPrefixCls,
direction
} = React.useContext(ConfigContext);
const [textLocale] = useLocale('Text');
const typographyRef = React.useRef(null);
const editIconRef = React.useRef(null);
// ============================ MISC ============================
const prefixCls = getPrefixCls('typography', customizePrefixCls);
const textProps = omit(restProps, DECORATION_PROPS);
// ========================== Editable ==========================
const [enableEdit, editConfig] = useMergedConfig(editable);
const [editing, setEditing] = useMergedState(false, {
value: editConfig.editing
});
const {
triggerType = ['icon']
} = editConfig;
const triggerEdit = edit => {
var _a;
if (edit) {
(_a = editConfig.onStart) === null || _a === void 0 ? void 0 : _a.call(editConfig);
}
setEditing(edit);
};
// Focus edit icon when back
const prevEditing = usePrevious(editing);
useLayoutEffect(() => {
var _a;
if (!editing && prevEditing) {
(_a = editIconRef.current) === null || _a === void 0 ? void 0 : _a.focus();
}
}, [editing]);
const onEditClick = e => {
e === null || e === void 0 ? void 0 : e.preventDefault();
triggerEdit(true);
};
const onEditChange = value => {
var _a;
(_a = editConfig.onChange) === null || _a === void 0 ? void 0 : _a.call(editConfig, value);
triggerEdit(false);
};
const onEditCancel = () => {
var _a;
(_a = editConfig.onCancel) === null || _a === void 0 ? void 0 : _a.call(editConfig);
triggerEdit(false);
};
// ========================== Copyable ==========================
const [enableCopy, copyConfig] = useMergedConfig(copyable);
const {
copied,
copyLoading,
onClick: onCopyClick
} = useCopyClick({
copyConfig,
children
});
// ========================== Ellipsis ==========================
const [isLineClampSupport, setIsLineClampSupport] = React.useState(false);
const [isTextOverflowSupport, setIsTextOverflowSupport] = React.useState(false);
const [isJsEllipsis, setIsJsEllipsis] = React.useState(false);
const [isNativeEllipsis, setIsNativeEllipsis] = React.useState(false);
const [isNativeVisible, setIsNativeVisible] = React.useState(true);
const [enableEllipsis, ellipsisConfig] = useMergedConfig(ellipsis, {
expandable: false,
symbol: isExpanded => isExpanded ? textLocale === null || textLocale === void 0 ? void 0 : textLocale.collapse : textLocale === null || textLocale === void 0 ? void 0 : textLocale.expand
});
const [expanded, setExpanded] = useMergedState(ellipsisConfig.defaultExpanded || false, {
value: ellipsisConfig.expanded
});
const mergedEnableEllipsis = enableEllipsis && (!expanded || ellipsisConfig.expandable === 'collapsible');
// Shared prop to reduce bundle size
const {
rows = 1
} = ellipsisConfig;
const needMeasureEllipsis = React.useMemo(() =>
// Disable ellipsis
mergedEnableEllipsis && (
// Provide suffix
ellipsisConfig.suffix !== undefined || ellipsisConfig.onEllipsis ||
// Can't use css ellipsis since we need to provide the place for button
ellipsisConfig.expandable || enableEdit || enableCopy), [mergedEnableEllipsis, ellipsisConfig, enableEdit, enableCopy]);
useLayoutEffect(() => {
if (enableEllipsis && !needMeasureEllipsis) {
setIsLineClampSupport(isStyleSupport('webkitLineClamp'));
setIsTextOverflowSupport(isStyleSupport('textOverflow'));
}
}, [needMeasureEllipsis, enableEllipsis]);
const [cssEllipsis, setCssEllipsis] = React.useState(mergedEnableEllipsis);
const canUseCssEllipsis = React.useMemo(() => {
if (needMeasureEllipsis) {
return false;
}
if (rows === 1) {
return isTextOverflowSupport;
}
return isLineClampSupport;
}, [needMeasureEllipsis, isTextOverflowSupport, isLineClampSupport]);
// We use effect to change from css ellipsis to js ellipsis.
// To make SSR still can see the ellipsis.
useLayoutEffect(() => {
setCssEllipsis(canUseCssEllipsis && mergedEnableEllipsis);
}, [canUseCssEllipsis, mergedEnableEllipsis]);
const isMergedEllipsis = mergedEnableEllipsis && (cssEllipsis ? isNativeEllipsis : isJsEllipsis);
const cssTextOverflow = mergedEnableEllipsis && rows === 1 && cssEllipsis;
const cssLineClamp = mergedEnableEllipsis && rows > 1 && cssEllipsis;
// >>>>> Expand
const onExpandClick = (e, info) => {
var _a;
setExpanded(info.expanded);
(_a = ellipsisConfig.onExpand) === null || _a === void 0 ? void 0 : _a.call(ellipsisConfig, e, info);
};
const [ellipsisWidth, setEllipsisWidth] = React.useState(0);
const onResize = ({
offsetWidth
}) => {
setEllipsisWidth(offsetWidth);
};
// >>>>> JS Ellipsis
const onJsEllipsis = jsEllipsis => {
var _a;
setIsJsEllipsis(jsEllipsis);
// Trigger if changed
if (isJsEllipsis !== jsEllipsis) {
(_a = ellipsisConfig.onEllipsis) === null || _a === void 0 ? void 0 : _a.call(ellipsisConfig, jsEllipsis);
}
};
// >>>>> Native ellipsis
React.useEffect(() => {
const textEle = typographyRef.current;
if (enableEllipsis && cssEllipsis && textEle) {
const currentEllipsis = isEleEllipsis(textEle);
if (isNativeEllipsis !== currentEllipsis) {
setIsNativeEllipsis(currentEllipsis);
}
}
}, [enableEllipsis, cssEllipsis, children, cssLineClamp, isNativeVisible, ellipsisWidth]);
// https://github.com/ant-design/ant-design/issues/36786
// Use IntersectionObserver to check if element is invisible
React.useEffect(() => {
const textEle = typographyRef.current;
if (typeof IntersectionObserver === 'undefined' || !textEle || !cssEllipsis || !mergedEnableEllipsis) {
return;
}
/* eslint-disable-next-line compat/compat */
const observer = new IntersectionObserver(() => {
setIsNativeVisible(!!textEle.offsetParent);
});
observer.observe(textEle);
return () => {
observer.disconnect();
};
}, [cssEllipsis, mergedEnableEllipsis]);
// ========================== Tooltip ===========================
const tooltipProps = useTooltipProps(ellipsisConfig.tooltip, editConfig.text, children);
const topAriaLabel = React.useMemo(() => {
if (!enableEllipsis || cssEllipsis) {
return undefined;
}
return [editConfig.text, children, title, tooltipProps.title].find(isValidText);
}, [enableEllipsis, cssEllipsis, title, tooltipProps.title, isMergedEllipsis]);
// =========================== Render ===========================
// >>>>>>>>>>> Editing input
if (editing) {
return /*#__PURE__*/React.createElement(Editable, {
value: (_a = editConfig.text) !== null && _a !== void 0 ? _a : typeof children === 'string' ? children : '',
onSave: onEditChange,
onCancel: onEditCancel,
onEnd: editConfig.onEnd,
prefixCls: prefixCls,
className: className,
style: style,
direction: direction,
component: component,
maxLength: editConfig.maxLength,
autoSize: editConfig.autoSize,
enterIcon: editConfig.enterIcon
});
}
// >>>>>>>>>>> Typography
// Expand
const renderExpand = () => {
const {
expandable,
symbol
} = ellipsisConfig;
return expandable ? (/*#__PURE__*/React.createElement("button", {
type: "button",
key: "expand",
className: `${prefixCls}-${expanded ? 'collapse' : 'expand'}`,
onClick: e => onExpandClick(e, {
expanded: !expanded
}),
"aria-label": expanded ? textLocale.collapse : textLocale === null || textLocale === void 0 ? void 0 : textLocale.expand
}, typeof symbol === 'function' ? symbol(expanded) : symbol)) : null;
};
// Edit
const renderEdit = () => {
if (!enableEdit) {
return;
}
const {
icon,
tooltip,
tabIndex
} = editConfig;
const editTitle = toArray(tooltip)[0] || (textLocale === null || textLocale === void 0 ? void 0 : textLocale.edit);
const ariaLabel = typeof editTitle === 'string' ? editTitle : '';
return triggerType.includes('icon') ? (/*#__PURE__*/React.createElement(Tooltip, {
key: "edit",
title: tooltip === false ? '' : editTitle
}, /*#__PURE__*/React.createElement("button", {
type: "button",
ref: editIconRef,
className: `${prefixCls}-edit`,
onClick: onEditClick,
"aria-label": ariaLabel,
tabIndex: tabIndex
}, icon || /*#__PURE__*/React.createElement(EditOutlined, {
role: "button"
})))) : null;
};
// Copy
const renderCopy = () => {
if (!enableCopy) {
return null;
}
return /*#__PURE__*/React.createElement(CopyBtn, Object.assign({
key: "copy"
}, copyConfig, {
prefixCls: prefixCls,
copied: copied,
locale: textLocale,
onCopy: onCopyClick,
loading: copyLoading,
iconOnly: children === null || children === undefined
}));
};
const renderOperations = canEllipsis => [canEllipsis && renderExpand(), renderEdit(), renderCopy()];
const renderEllipsis = canEllipsis => [canEllipsis && !expanded && (/*#__PURE__*/React.createElement("span", {
"aria-hidden": true,
key: "ellipsis"
}, ELLIPSIS_STR)), ellipsisConfig.suffix, renderOperations(canEllipsis)];
return /*#__PURE__*/React.createElement(ResizeObserver, {
onResize: onResize,
disabled: !mergedEnableEllipsis
}, resizeRef => (/*#__PURE__*/React.createElement(EllipsisTooltip, {
tooltipProps: tooltipProps,
enableEllipsis: mergedEnableEllipsis,
isEllipsis: isMergedEllipsis
}, /*#__PURE__*/React.createElement(Typography, Object.assign({
className: classNames({
[`${prefixCls}-${type}`]: type,
[`${prefixCls}-disabled`]: disabled,
[`${prefixCls}-ellipsis`]: enableEllipsis,
[`${prefixCls}-ellipsis-single-line`]: cssTextOverflow,
[`${prefixCls}-ellipsis-multiple-line`]: cssLineClamp
}, className),
prefixCls: customizePrefixCls,
style: Object.assign(Object.assign({}, style), {
WebkitLineClamp: cssLineClamp ? rows : undefined
}),
component: component,
ref: composeRef(resizeRef, typographyRef, ref),
direction: direction,
onClick: triggerType.includes('text') ? onEditClick : undefined,
"aria-label": topAriaLabel === null || topAriaLabel === void 0 ? void 0 : topAriaLabel.toString(),
title: title
}, textProps), /*#__PURE__*/React.createElement(Ellipsis, {
enableMeasure: mergedEnableEllipsis && !cssEllipsis,
text: children,
rows: rows,
width: ellipsisWidth,
onEllipsis: onJsEllipsis,
expanded: expanded,
miscDeps: [copied, expanded, copyLoading, enableEdit, enableCopy, textLocale].concat(_toConsumableArray(DECORATION_PROPS.map(key => props[key])))
}, (node, canEllipsis) => wrapperDecorations(props, /*#__PURE__*/React.createElement(React.Fragment, null, node.length > 0 && canEllipsis && !expanded && topAriaLabel ? (/*#__PURE__*/React.createElement("span", {
key: "show-content",
"aria-hidden": true
}, node)) : node, renderEllipsis(canEllipsis))))))));
});
export default Base;

10
node_modules/antd/es/typography/Base/util.d.ts generated vendored Normal file
View File

@@ -0,0 +1,10 @@
export declare function toList<T>(val: T | T[]): T[];
export declare function getNode(dom: React.ReactNode, defaultNode: React.ReactNode, needDom?: boolean): import("react").ReactNode;
/**
* Check for element is native ellipsis
* ref:
* - https://github.com/ant-design/ant-design/issues/50143
* - https://github.com/ant-design/ant-design/issues/50414
*/
export declare function isEleEllipsis(ele: HTMLElement): boolean;
export declare const isValidText: (val: any) => val is string | number;

39
node_modules/antd/es/typography/Base/util.js generated vendored Normal file
View File

@@ -0,0 +1,39 @@
export function toList(val) {
if (val === false) {
return [false, false];
}
return Array.isArray(val) ? val : [val];
}
export function getNode(dom, defaultNode, needDom) {
if (dom === true || dom === undefined) {
return defaultNode;
}
return dom || needDom && defaultNode;
}
/**
* Check for element is native ellipsis
* ref:
* - https://github.com/ant-design/ant-design/issues/50143
* - https://github.com/ant-design/ant-design/issues/50414
*/
export function isEleEllipsis(ele) {
// Create a new div to get the size
const childDiv = document.createElement('em');
ele.appendChild(childDiv);
// For test case
if (process.env.NODE_ENV !== 'production') {
childDiv.className = 'ant-typography-css-ellipsis-content-measure';
}
const rect = ele.getBoundingClientRect();
const childRect = childDiv.getBoundingClientRect();
// Reset
ele.removeChild(childDiv);
// Range checker
return (
// Horizontal out of range
rect.left > childRect.left || childRect.right > rect.right ||
// Vertical out of range
rect.top > childRect.top || childRect.bottom > rect.bottom
);
}
export const isValidText = val => ['string', 'number'].includes(typeof val);

20
node_modules/antd/es/typography/Editable.d.ts generated vendored Normal file
View File

@@ -0,0 +1,20 @@
import * as React from 'react';
import type { TextAreaProps } from 'rc-textarea';
import type { DirectionType } from '../config-provider';
interface EditableProps {
prefixCls: string;
value: string;
'aria-label'?: string;
onSave: (value: string) => void;
onCancel: () => void;
onEnd?: () => void;
className?: string;
style?: React.CSSProperties;
direction?: DirectionType;
maxLength?: number;
autoSize?: TextAreaProps['autoSize'];
enterIcon?: React.ReactNode;
component?: string;
}
declare const Editable: React.FC<EditableProps>;
export default Editable;

115
node_modules/antd/es/typography/Editable.js generated vendored Normal file
View File

@@ -0,0 +1,115 @@
"use client";
import * as React from 'react';
import EnterOutlined from "@ant-design/icons/es/icons/EnterOutlined";
import classNames from 'classnames';
import KeyCode from "rc-util/es/KeyCode";
import { cloneElement } from '../_util/reactNode';
import TextArea from '../input/TextArea';
import useStyle from './style';
const Editable = props => {
const {
prefixCls,
'aria-label': ariaLabel,
className,
style,
direction,
maxLength,
autoSize = true,
value,
onSave,
onCancel,
onEnd,
component,
enterIcon = /*#__PURE__*/React.createElement(EnterOutlined, null)
} = props;
const ref = React.useRef(null);
const inComposition = React.useRef(false);
const lastKeyCode = React.useRef(null);
const [current, setCurrent] = React.useState(value);
React.useEffect(() => {
setCurrent(value);
}, [value]);
React.useEffect(() => {
var _a;
if ((_a = ref.current) === null || _a === void 0 ? void 0 : _a.resizableTextArea) {
const {
textArea
} = ref.current.resizableTextArea;
textArea.focus();
const {
length
} = textArea.value;
textArea.setSelectionRange(length, length);
}
}, []);
const onChange = ({
target
}) => {
setCurrent(target.value.replace(/[\n\r]/g, ''));
};
const onCompositionStart = () => {
inComposition.current = true;
};
const onCompositionEnd = () => {
inComposition.current = false;
};
const onKeyDown = ({
keyCode
}) => {
// We don't record keyCode when IME is using
if (inComposition.current) {
return;
}
lastKeyCode.current = keyCode;
};
const confirmChange = () => {
onSave(current.trim());
};
const onKeyUp = ({
keyCode,
ctrlKey,
altKey,
metaKey,
shiftKey
}) => {
// Check if it's a real key
if (lastKeyCode.current !== keyCode || inComposition.current || ctrlKey || altKey || metaKey || shiftKey) {
return;
}
if (keyCode === KeyCode.ENTER) {
confirmChange();
onEnd === null || onEnd === void 0 ? void 0 : onEnd();
} else if (keyCode === KeyCode.ESC) {
onCancel();
}
};
const onBlur = () => {
confirmChange();
};
const [wrapCSSVar, hashId, cssVarCls] = useStyle(prefixCls);
const textAreaClassName = classNames(prefixCls, `${prefixCls}-edit-content`, {
[`${prefixCls}-rtl`]: direction === 'rtl',
[`${prefixCls}-${component}`]: !!component
}, className, hashId, cssVarCls);
return wrapCSSVar(/*#__PURE__*/React.createElement("div", {
className: textAreaClassName,
style: style
}, /*#__PURE__*/React.createElement(TextArea, {
ref: ref,
maxLength: maxLength,
value: current,
onChange: onChange,
onKeyDown: onKeyDown,
onKeyUp: onKeyUp,
onCompositionStart: onCompositionStart,
onCompositionEnd: onCompositionEnd,
onBlur: onBlur,
"aria-label": ariaLabel,
rows: 1,
autoSize: autoSize
}), enterIcon !== null ? cloneElement(enterIcon, {
className: `${prefixCls}-edit-content-confirm`
}) : null));
};
export default Editable;

7
node_modules/antd/es/typography/Link.d.ts generated vendored Normal file
View File

@@ -0,0 +1,7 @@
import * as React from 'react';
import type { BlockProps } from './Base';
export interface LinkProps extends BlockProps<'a'>, Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'type' | keyof BlockProps<'a'>> {
ellipsis?: boolean;
}
declare const Link: React.ForwardRefExoticComponent<LinkProps & React.RefAttributes<HTMLElement>>;
export default Link;

36
node_modules/antd/es/typography/Link.js generated vendored Normal file
View File

@@ -0,0 +1,36 @@
"use client";
var __rest = this && this.__rest || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
import * as React from 'react';
import { devUseWarning } from '../_util/warning';
import Base from './Base';
const Link = /*#__PURE__*/React.forwardRef((props, ref) => {
const {
ellipsis,
rel,
children,
// @ts-expect-error: https://github.com/ant-design/ant-design/issues/26622
navigate: _navigate
} = props,
restProps = __rest(props, ["ellipsis", "rel", "children", "navigate"]);
if (process.env.NODE_ENV !== 'production') {
const warning = devUseWarning('Typography.Link');
process.env.NODE_ENV !== "production" ? warning(typeof ellipsis !== 'object', 'usage', '`ellipsis` only supports boolean value.') : void 0;
}
const mergedProps = Object.assign(Object.assign({}, restProps), {
rel: rel === undefined && restProps.target === '_blank' ? 'noopener noreferrer' : rel
});
return /*#__PURE__*/React.createElement(Base, Object.assign({}, mergedProps, {
ref: ref,
ellipsis: !!ellipsis,
component: "a"
}), children);
});
export default Link;

6
node_modules/antd/es/typography/Paragraph.d.ts generated vendored Normal file
View File

@@ -0,0 +1,6 @@
import * as React from 'react';
import type { BlockProps } from './Base';
export interface ParagraphProps extends BlockProps<'div'>, Omit<React.HTMLAttributes<HTMLDivElement>, 'type' | keyof BlockProps<'div'>> {
}
declare const Paragraph: React.ForwardRefExoticComponent<ParagraphProps & React.RefAttributes<HTMLElement>>;
export default Paragraph;

24
node_modules/antd/es/typography/Paragraph.js generated vendored Normal file
View File

@@ -0,0 +1,24 @@
"use client";
var __rest = this && this.__rest || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
import * as React from 'react';
import Base from './Base';
const Paragraph = /*#__PURE__*/React.forwardRef((props, ref) => {
const {
children
} = props,
restProps = __rest(props, ["children"]);
return /*#__PURE__*/React.createElement(Base, Object.assign({
ref: ref
}, restProps, {
component: "div"
}), children);
});
export default Paragraph;

7
node_modules/antd/es/typography/Text.d.ts generated vendored Normal file
View File

@@ -0,0 +1,7 @@
import * as React from 'react';
import type { BlockProps, EllipsisConfig } from './Base';
export interface TextProps extends BlockProps<'span'>, Omit<React.HTMLAttributes<HTMLSpanElement>, 'type' | keyof BlockProps<'span'>> {
ellipsis?: boolean | Omit<EllipsisConfig, 'expandable' | 'rows' | 'onExpand'>;
}
declare const _default: React.ForwardRefExoticComponent<TextProps & React.RefAttributes<HTMLSpanElement>>;
export default _default;

38
node_modules/antd/es/typography/Text.js generated vendored Normal file
View File

@@ -0,0 +1,38 @@
"use client";
var __rest = this && this.__rest || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
import * as React from 'react';
import omit from "rc-util/es/omit";
import { devUseWarning } from '../_util/warning';
import Base from './Base';
const Text = (props, ref) => {
const {
ellipsis,
children
} = props,
restProps = __rest(props, ["ellipsis", "children"]);
const mergedEllipsis = React.useMemo(() => {
if (ellipsis && typeof ellipsis === 'object') {
return omit(ellipsis, ['expandable', 'rows']);
}
return ellipsis;
}, [ellipsis]);
if (process.env.NODE_ENV !== 'production') {
const warning = devUseWarning('Typography.Text');
process.env.NODE_ENV !== "production" ? warning(typeof ellipsis !== 'object' || !ellipsis || !('expandable' in ellipsis) && !('rows' in ellipsis), 'usage', '`ellipsis` do not support `expandable` or `rows` props.') : void 0;
}
return /*#__PURE__*/React.createElement(Base, Object.assign({
ref: ref
}, restProps, {
ellipsis: mergedEllipsis,
component: "span"
}), children);
};
export default /*#__PURE__*/React.forwardRef(Text);

8
node_modules/antd/es/typography/Title.d.ts generated vendored Normal file
View File

@@ -0,0 +1,8 @@
import * as React from 'react';
import type { BlockProps } from './Base';
declare const TITLE_ELE_LIST: readonly [1, 2, 3, 4, 5];
export interface TitleProps extends Omit<BlockProps<'h1' | 'h2' | 'h3' | 'h4' | 'h5'>, 'strong'>, Omit<React.HTMLAttributes<HTMLHeadElement>, 'type' | keyof BlockProps<'h1' | 'h2' | 'h3' | 'h4' | 'h5'>> {
level?: (typeof TITLE_ELE_LIST)[number];
}
declare const Title: React.ForwardRefExoticComponent<TitleProps & React.RefAttributes<HTMLElement>>;
export default Title;

32
node_modules/antd/es/typography/Title.js generated vendored Normal file
View File

@@ -0,0 +1,32 @@
"use client";
var __rest = this && this.__rest || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
import * as React from 'react';
import { devUseWarning } from '../_util/warning';
import Base from './Base';
const TITLE_ELE_LIST = [1, 2, 3, 4, 5];
const Title = /*#__PURE__*/React.forwardRef((props, ref) => {
const {
level = 1,
children
} = props,
restProps = __rest(props, ["level", "children"]);
if (process.env.NODE_ENV !== 'production') {
const warning = devUseWarning('Typography.Title');
process.env.NODE_ENV !== "production" ? warning(TITLE_ELE_LIST.includes(level), 'usage', 'Title only accept `1 | 2 | 3 | 4 | 5` as `level` value. And `5` need 4.6.0+ version.') : void 0;
}
const component = TITLE_ELE_LIST.includes(level) ? `h${level}` : `h1`;
return /*#__PURE__*/React.createElement(Base, Object.assign({
ref: ref
}, restProps, {
component: component
}), children);
});
export default Title;

19
node_modules/antd/es/typography/Typography.d.ts generated vendored Normal file
View File

@@ -0,0 +1,19 @@
import * as React from 'react';
import type { JSX } from 'react';
import type { DirectionType } from '../config-provider';
export interface TypographyProps<C extends keyof JSX.IntrinsicElements> extends React.HTMLAttributes<HTMLElement> {
id?: string;
prefixCls?: string;
className?: string;
rootClassName?: string;
style?: React.CSSProperties;
children?: React.ReactNode;
'aria-label'?: string;
direction?: DirectionType;
}
interface InternalTypographyProps<C extends keyof JSX.IntrinsicElements> extends TypographyProps<C> {
/** @deprecated Use `ref` directly if using React 16 */
setContentRef?: (node: HTMLElement) => void;
}
declare const Typography: React.ForwardRefExoticComponent<InternalTypographyProps<keyof JSX.IntrinsicElements> & React.RefAttributes<HTMLElement>>;
export default Typography;

60
node_modules/antd/es/typography/Typography.js generated vendored Normal file
View File

@@ -0,0 +1,60 @@
"use client";
var __rest = this && this.__rest || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
import * as React from 'react';
import classNames from 'classnames';
import { composeRef } from "rc-util/es/ref";
import { devUseWarning } from '../_util/warning';
import { useComponentConfig } from '../config-provider/context';
import useStyle from './style';
const Typography = /*#__PURE__*/React.forwardRef((props, ref) => {
const {
prefixCls: customizePrefixCls,
component: Component = 'article',
className,
rootClassName,
setContentRef,
children,
direction: typographyDirection,
style
} = props,
restProps = __rest(props, ["prefixCls", "component", "className", "rootClassName", "setContentRef", "children", "direction", "style"]);
const {
getPrefixCls,
direction: contextDirection,
className: contextClassName,
style: contextStyle
} = useComponentConfig('typography');
const direction = typographyDirection !== null && typographyDirection !== void 0 ? typographyDirection : contextDirection;
const mergedRef = setContentRef ? composeRef(ref, setContentRef) : ref;
const prefixCls = getPrefixCls('typography', customizePrefixCls);
if (process.env.NODE_ENV !== 'production') {
const warning = devUseWarning('Typography');
warning.deprecated(!setContentRef, 'setContentRef', 'ref');
}
// Style
const [wrapCSSVar, hashId, cssVarCls] = useStyle(prefixCls);
const componentClassName = classNames(prefixCls, contextClassName, {
[`${prefixCls}-rtl`]: direction === 'rtl'
}, className, rootClassName, hashId, cssVarCls);
const mergedStyle = Object.assign(Object.assign({}, contextStyle), style);
return wrapCSSVar(
/*#__PURE__*/
// @ts-expect-error: Expression produces a union type that is too complex to represent.
React.createElement(Component, Object.assign({
className: componentClassName,
style: mergedStyle,
ref: mergedRef
}, restProps), children));
});
if (process.env.NODE_ENV !== 'production') {
Typography.displayName = 'Typography';
}
export default Typography;

View File

@@ -0,0 +1,11 @@
import * as React from 'react';
import type { CopyConfig } from '../Base';
declare const useCopyClick: ({ copyConfig, children, }: {
copyConfig: CopyConfig;
children?: React.ReactNode;
}) => {
copied: boolean;
copyLoading: boolean;
onClick: (e?: React.MouseEvent<HTMLButtonElement>) => Promise<void>;
};
export default useCopyClick;

77
node_modules/antd/es/typography/hooks/useCopyClick.js generated vendored Normal file
View File

@@ -0,0 +1,77 @@
var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
function adopt(value) {
return value instanceof P ? value : new P(function (resolve) {
resolve(value);
});
}
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) {
try {
step(generator.next(value));
} catch (e) {
reject(e);
}
}
function rejected(value) {
try {
step(generator["throw"](value));
} catch (e) {
reject(e);
}
}
function step(result) {
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
}
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
import * as React from 'react';
import copy from 'copy-to-clipboard';
import useEvent from "rc-util/es/hooks/useEvent";
import toList from '../../_util/toList';
const useCopyClick = ({
copyConfig,
children
}) => {
const [copied, setCopied] = React.useState(false);
const [copyLoading, setCopyLoading] = React.useState(false);
const copyIdRef = React.useRef(null);
const cleanCopyId = () => {
if (copyIdRef.current) {
clearTimeout(copyIdRef.current);
}
};
const copyOptions = {};
if (copyConfig.format) {
copyOptions.format = copyConfig.format;
}
React.useEffect(() => cleanCopyId, []);
// Keep copy action up to date
const onClick = useEvent(e => __awaiter(void 0, void 0, void 0, function* () {
var _a;
e === null || e === void 0 ? void 0 : e.preventDefault();
e === null || e === void 0 ? void 0 : e.stopPropagation();
setCopyLoading(true);
try {
const text = typeof copyConfig.text === 'function' ? yield copyConfig.text() : copyConfig.text;
copy(text || toList(children, true).join('') || '', copyOptions);
setCopyLoading(false);
setCopied(true);
// Trigger tips update
cleanCopyId();
copyIdRef.current = setTimeout(() => {
setCopied(false);
}, 3000);
(_a = copyConfig.onCopy) === null || _a === void 0 ? void 0 : _a.call(copyConfig, e);
} catch (error) {
setCopyLoading(false);
throw error;
}
}));
return {
copied,
copyLoading,
onClick
};
};
export default useCopyClick;

View File

@@ -0,0 +1 @@
export default function useMergedConfig<Target>(propConfig: any, templateConfig?: Target): readonly [boolean, Target];

View File

@@ -0,0 +1,7 @@
import * as React from 'react';
export default function useMergedConfig(propConfig, templateConfig) {
return React.useMemo(() => {
const support = !!propConfig;
return [support, Object.assign(Object.assign({}, templateConfig), support && typeof propConfig === 'object' ? propConfig : null)];
}, [propConfig]);
}

View File

@@ -0,0 +1,2 @@
declare const usePrevious: <T>(value: T) => T | undefined;
export default usePrevious;

9
node_modules/antd/es/typography/hooks/usePrevious.js generated vendored Normal file
View File

@@ -0,0 +1,9 @@
import { useEffect, useRef } from 'react';
const usePrevious = value => {
const ref = useRef(undefined);
useEffect(() => {
ref.current = value;
});
return ref.current;
};
export default usePrevious;

View File

@@ -0,0 +1,64 @@
import type { TooltipProps } from '../../tooltip';
declare const useTooltipProps: (tooltip: React.ReactNode | TooltipProps, editConfigText: React.ReactNode, children: React.ReactNode) => {
[Symbol.iterator](): Iterator<import("react").ReactNode, any, any>;
title: import("react").ReactNode;
} | {
then<TResult1 = string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | null | undefined, TResult2 = never>(onfulfilled?: ((value: string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | null | undefined) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null | undefined): Promise<TResult1 | TResult2>;
catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null | undefined): Promise<(string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | null | undefined) | TResult>;
finally(onfinally?: (() => void) | null | undefined): Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | null | undefined>;
[Symbol.toStringTag]: string;
title: import("react").ReactNode;
} | {
title: React.ReactNode | import("../../_util/getRenderPropValue").RenderFunction;
overlay?: React.ReactNode | import("../../_util/getRenderPropValue").RenderFunction;
styles?: Partial<Record<"body" | "root", React.CSSProperties>>;
classNames?: Partial<Record<"body" | "root", string>>;
style?: React.CSSProperties;
className?: string;
rootClassName?: string;
color?: import("../../_util/type").LiteralUnion<import("../../_util/colors").PresetColorType>;
placement?: import("../../tooltip").TooltipPlacement;
builtinPlacements?: typeof import("rc-tooltip/lib/placements").placements;
openClassName?: string;
arrowPointAtCenter?: boolean;
arrow?: boolean | {
arrowPointAtCenter?: boolean;
pointAtCenter?: boolean;
};
autoAdjustOverflow?: boolean | import("../../tooltip").AdjustOverflow;
getPopupContainer?: (triggerNode: HTMLElement) => HTMLElement;
children?: React.ReactNode;
destroyTooltipOnHide?: boolean | {
keepParent?: boolean;
};
destroyOnHidden?: boolean;
open?: import("rc-tooltip/lib/Tooltip").TooltipProps["visible"];
defaultOpen?: import("rc-tooltip/lib/Tooltip").TooltipProps["defaultVisible"];
onOpenChange?: import("rc-tooltip/lib/Tooltip").TooltipProps["onVisibleChange"];
afterOpenChange?: import("rc-tooltip/lib/Tooltip").TooltipProps["afterVisibleChange"];
visible?: import("rc-tooltip/lib/Tooltip").TooltipProps["visible"];
defaultVisible?: import("rc-tooltip/lib/Tooltip").TooltipProps["defaultVisible"];
onVisibleChange?: import("rc-tooltip/lib/Tooltip").TooltipProps["onVisibleChange"];
afterVisibleChange?: import("rc-tooltip/lib/Tooltip").TooltipProps["afterVisibleChange"];
zIndex?: number | undefined;
animation?: import("@rc-component/trigger/lib/interface").AnimationType | undefined;
motion?: import("rc-motion").CSSMotionProps | undefined;
prefixCls?: string | undefined;
align?: import("@rc-component/trigger").AlignType | undefined;
id?: string | undefined;
transitionName?: string | undefined;
showArrow?: (boolean | import("@rc-component/trigger").ArrowType) | undefined;
forceRender?: boolean | undefined;
popupVisible?: boolean | undefined;
onPopupAlign?: ((element: HTMLElement, align: import("@rc-component/trigger").AlignType) => void) | undefined;
fresh?: boolean | undefined;
mouseLeaveDelay?: number | undefined;
mouseEnterDelay?: number | undefined;
trigger?: (import("@rc-component/trigger").ActionType | import("@rc-component/trigger").ActionType[]) | undefined;
overlayStyle?: React.CSSProperties | undefined;
overlayClassName?: string | undefined;
getTooltipContainer?: ((node: HTMLElement) => HTMLElement) | undefined;
arrowContent?: import("react").ReactNode;
overlayInnerStyle?: React.CSSProperties | undefined;
};
export default useTooltipProps;

View File

@@ -0,0 +1,22 @@
import { isValidElement, useMemo } from 'react';
const useTooltipProps = (tooltip, editConfigText, children) => useMemo(() => {
if (tooltip === true) {
return {
title: editConfigText !== null && editConfigText !== void 0 ? editConfigText : children
};
}
if (/*#__PURE__*/isValidElement(tooltip)) {
return {
title: tooltip
};
}
if (typeof tooltip === 'object') {
return Object.assign({
title: editConfigText !== null && editConfigText !== void 0 ? editConfigText : children
}, tooltip);
}
return {
title: tooltip
};
}, [tooltip, editConfigText, children]);
export default useTooltipProps;

13
node_modules/antd/es/typography/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,13 @@
import Link from './Link';
import Paragraph from './Paragraph';
import Text from './Text';
import Title from './Title';
import OriginTypography from './Typography';
export type TypographyProps = typeof OriginTypography & {
Text: typeof Text;
Link: typeof Link;
Title: typeof Title;
Paragraph: typeof Paragraph;
};
declare const Typography: TypographyProps;
export default Typography;

13
node_modules/antd/es/typography/index.js generated vendored Normal file
View File

@@ -0,0 +1,13 @@
"use client";
import Link from './Link';
import Paragraph from './Paragraph';
import Text from './Text';
import Title from './Title';
import OriginTypography from './Typography';
const Typography = OriginTypography;
Typography.Text = Text;
Typography.Link = Link;
Typography.Title = Title;
Typography.Paragraph = Paragraph;
export default Typography;

18
node_modules/antd/es/typography/style/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,18 @@
import type { FullToken, GetDefaultToken } from '../../theme/internal';
/** Component only token. Which will handle additional calculation of alias token */
export interface ComponentToken {
/**
* @desc 标题上间距
* @descEN Margin top of title
*/
titleMarginTop: number | string;
/**
* @desc 标题下间距
* @descEN Margin bottom of title
*/
titleMarginBottom: number | string;
}
export type TypographyToken = FullToken<'Typography'>;
export declare const prepareComponentToken: GetDefaultToken<'Typography'>;
declare const _default: (prefixCls: string, rootCls?: string) => readonly [(node: React.ReactElement) => React.ReactElement, string, string];
export default _default;

95
node_modules/antd/es/typography/style/index.js generated vendored Normal file
View File

@@ -0,0 +1,95 @@
import { operationUnit } from '../../style';
import { genStyleHooks } from '../../theme/internal';
import { getCopyableStyles, getEditableStyles, getEllipsisStyles, getLinkStyles, getResetStyles, getTitleStyles } from './mixins';
const genTypographyStyle = token => {
const {
componentCls,
titleMarginTop
} = token;
return {
[componentCls]: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({
color: token.colorText,
wordBreak: 'break-word',
lineHeight: token.lineHeight,
[`&${componentCls}-secondary`]: {
color: token.colorTextDescription
},
[`&${componentCls}-success`]: {
color: token.colorSuccessText
},
[`&${componentCls}-warning`]: {
color: token.colorWarningText
},
[`&${componentCls}-danger`]: {
color: token.colorErrorText,
'a&:active, a&:focus': {
color: token.colorErrorTextActive
},
'a&:hover': {
color: token.colorErrorTextHover
}
},
[`&${componentCls}-disabled`]: {
color: token.colorTextDisabled,
cursor: 'not-allowed',
userSelect: 'none'
},
[`
div&,
p
`]: {
marginBottom: '1em'
}
}, getTitleStyles(token)), {
[`
& + h1${componentCls},
& + h2${componentCls},
& + h3${componentCls},
& + h4${componentCls},
& + h5${componentCls}
`]: {
marginTop: titleMarginTop
},
[`
div,
ul,
li,
p,
h1,
h2,
h3,
h4,
h5`]: {
[`
+ h1,
+ h2,
+ h3,
+ h4,
+ h5
`]: {
marginTop: titleMarginTop
}
}
}), getResetStyles(token)), getLinkStyles(token)), {
// Operation
[`
${componentCls}-expand,
${componentCls}-collapse,
${componentCls}-edit,
${componentCls}-copy
`]: Object.assign(Object.assign({}, operationUnit(token)), {
marginInlineStart: token.marginXXS
})
}), getEditableStyles(token)), getCopyableStyles(token)), getEllipsisStyles()), {
'&-rtl': {
direction: 'rtl'
}
})
};
};
export const prepareComponentToken = () => ({
titleMarginTop: '1.2em',
titleMarginBottom: '0.5em'
});
// ============================== Export ==============================
export default genStyleHooks('Typography', genTypographyStyle, prepareComponentToken);

9
node_modules/antd/es/typography/style/mixins.d.ts generated vendored Normal file
View File

@@ -0,0 +1,9 @@
import type { CSSObject } from '@ant-design/cssinjs';
import type { TypographyToken } from '.';
import type { GenerateStyle } from '../../theme/internal';
export declare const getTitleStyles: GenerateStyle<TypographyToken, CSSObject>;
export declare const getLinkStyles: GenerateStyle<TypographyToken, CSSObject>;
export declare const getResetStyles: GenerateStyle<TypographyToken, CSSObject>;
export declare const getEditableStyles: GenerateStyle<TypographyToken, CSSObject>;
export declare const getCopyableStyles: GenerateStyle<TypographyToken, CSSObject>;
export declare const getEllipsisStyles: () => CSSObject;

226
node_modules/antd/es/typography/style/mixins.js generated vendored Normal file
View File

@@ -0,0 +1,226 @@
/*
.typography-title(@fontSize; @fontWeight; @lineHeight; @headingColor; @headingMarginBottom;) {
margin-bottom: @headingMarginBottom;
color: @headingColor;
font-weight: @fontWeight;
fontSize: @fontSize;
line-height: @lineHeight;
}
*/
import { gold } from '@ant-design/colors';
import { operationUnit } from '../../style';
const getTitleStyle = (fontSize, lineHeight, color, token) => {
const {
titleMarginBottom,
fontWeightStrong
} = token;
return {
marginBottom: titleMarginBottom,
color,
fontWeight: fontWeightStrong,
fontSize,
lineHeight
};
};
export const getTitleStyles = token => {
const headings = [1, 2, 3, 4, 5];
const styles = {};
headings.forEach(headingLevel => {
styles[`
h${headingLevel}&,
div&-h${headingLevel},
div&-h${headingLevel} > textarea,
h${headingLevel}
`] = getTitleStyle(token[`fontSizeHeading${headingLevel}`], token[`lineHeightHeading${headingLevel}`], token.colorTextHeading, token);
});
return styles;
};
export const getLinkStyles = token => {
const {
componentCls
} = token;
return {
'a&, a': Object.assign(Object.assign({}, operationUnit(token)), {
userSelect: 'text',
[`&[disabled], &${componentCls}-disabled`]: {
color: token.colorTextDisabled,
cursor: 'not-allowed',
'&:active, &:hover': {
color: token.colorTextDisabled
},
'&:active': {
pointerEvents: 'none'
}
}
})
};
};
export const getResetStyles = token => ({
code: {
margin: '0 0.2em',
paddingInline: '0.4em',
paddingBlock: '0.2em 0.1em',
fontSize: '85%',
fontFamily: token.fontFamilyCode,
background: 'rgba(150, 150, 150, 0.1)',
border: '1px solid rgba(100, 100, 100, 0.2)',
borderRadius: 3
},
kbd: {
margin: '0 0.2em',
paddingInline: '0.4em',
paddingBlock: '0.15em 0.1em',
fontSize: '90%',
fontFamily: token.fontFamilyCode,
background: 'rgba(150, 150, 150, 0.06)',
border: '1px solid rgba(100, 100, 100, 0.2)',
borderBottomWidth: 2,
borderRadius: 3
},
mark: {
padding: 0,
// FIXME hardcode in v4
backgroundColor: gold[2]
},
'u, ins': {
textDecoration: 'underline',
textDecorationSkipInk: 'auto'
},
's, del': {
textDecoration: 'line-through'
},
strong: {
fontWeight: token.fontWeightStrong
},
// list
'ul, ol': {
marginInline: 0,
marginBlock: '0 1em',
padding: 0,
li: {
marginInline: '20px 0',
marginBlock: 0,
paddingInline: '4px 0',
paddingBlock: 0
}
},
ul: {
listStyleType: 'circle',
ul: {
listStyleType: 'disc'
}
},
ol: {
listStyleType: 'decimal'
},
// pre & block
'pre, blockquote': {
margin: '1em 0'
},
pre: {
padding: '0.4em 0.6em',
whiteSpace: 'pre-wrap',
wordWrap: 'break-word',
background: 'rgba(150, 150, 150, 0.1)',
border: '1px solid rgba(100, 100, 100, 0.2)',
borderRadius: 3,
fontFamily: token.fontFamilyCode,
// Compatible for marked
code: {
display: 'inline',
margin: 0,
padding: 0,
fontSize: 'inherit',
fontFamily: 'inherit',
background: 'transparent',
border: 0
}
},
blockquote: {
paddingInline: '0.6em 0',
paddingBlock: 0,
borderInlineStart: '4px solid rgba(100, 100, 100, 0.2)',
opacity: 0.85
}
});
export const getEditableStyles = token => {
const {
componentCls,
paddingSM
} = token;
const inputShift = paddingSM;
return {
'&-edit-content': {
position: 'relative',
'div&': {
insetInlineStart: token.calc(token.paddingSM).mul(-1).equal(),
insetBlockStart: token.calc(inputShift).div(-2).add(1).equal(),
marginBottom: token.calc(inputShift).div(2).sub(2).equal()
},
[`${componentCls}-edit-content-confirm`]: {
position: 'absolute',
insetInlineEnd: token.calc(token.marginXS).add(2).equal(),
insetBlockEnd: token.marginXS,
color: token.colorIcon,
// default style
fontWeight: 'normal',
fontSize: token.fontSize,
fontStyle: 'normal',
pointerEvents: 'none'
},
textarea: {
margin: '0!important',
// Fix Editable Textarea flash in Firefox
MozTransition: 'none',
height: '1em'
}
}
};
};
export const getCopyableStyles = token => ({
[`${token.componentCls}-copy-success`]: {
[`
&,
&:hover,
&:focus`]: {
color: token.colorSuccess
}
},
[`${token.componentCls}-copy-icon-only`]: {
marginInlineStart: 0
}
});
export const getEllipsisStyles = () => ({
[`
a&-ellipsis,
span&-ellipsis
`]: {
display: 'inline-block',
maxWidth: '100%'
},
'&-ellipsis-single-line': {
whiteSpace: 'nowrap',
overflow: 'hidden',
textOverflow: 'ellipsis',
// https://blog.csdn.net/iefreer/article/details/50421025
'a&, span&': {
verticalAlign: 'bottom'
},
'> code': {
paddingBlock: 0,
maxWidth: 'calc(100% - 1.2em)',
display: 'inline-block',
overflow: 'hidden',
textOverflow: 'ellipsis',
verticalAlign: 'bottom',
// https://github.com/ant-design/ant-design/issues/45953
boxSizing: 'content-box'
}
},
'&-ellipsis-multiple-line': {
display: '-webkit-box',
overflow: 'hidden',
WebkitLineClamp: 3,
WebkitBoxOrient: 'vertical'
}
});