first commit
This commit is contained in:
11
frontend/node_modules/antd/es/typography/hooks/useCopyClick.d.ts
generated
vendored
Normal file
11
frontend/node_modules/antd/es/typography/hooks/useCopyClick.d.ts
generated
vendored
Normal 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
frontend/node_modules/antd/es/typography/hooks/useCopyClick.js
generated
vendored
Normal file
77
frontend/node_modules/antd/es/typography/hooks/useCopyClick.js
generated
vendored
Normal 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;
|
||||
1
frontend/node_modules/antd/es/typography/hooks/useMergedConfig.d.ts
generated
vendored
Normal file
1
frontend/node_modules/antd/es/typography/hooks/useMergedConfig.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export default function useMergedConfig<Target>(propConfig: any, templateConfig?: Target): readonly [boolean, Target];
|
||||
7
frontend/node_modules/antd/es/typography/hooks/useMergedConfig.js
generated
vendored
Normal file
7
frontend/node_modules/antd/es/typography/hooks/useMergedConfig.js
generated
vendored
Normal 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]);
|
||||
}
|
||||
2
frontend/node_modules/antd/es/typography/hooks/usePrevious.d.ts
generated
vendored
Normal file
2
frontend/node_modules/antd/es/typography/hooks/usePrevious.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
declare const usePrevious: <T>(value: T) => T | undefined;
|
||||
export default usePrevious;
|
||||
9
frontend/node_modules/antd/es/typography/hooks/usePrevious.js
generated
vendored
Normal file
9
frontend/node_modules/antd/es/typography/hooks/usePrevious.js
generated
vendored
Normal 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;
|
||||
64
frontend/node_modules/antd/es/typography/hooks/useTooltipProps.d.ts
generated
vendored
Normal file
64
frontend/node_modules/antd/es/typography/hooks/useTooltipProps.d.ts
generated
vendored
Normal 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;
|
||||
22
frontend/node_modules/antd/es/typography/hooks/useTooltipProps.js
generated
vendored
Normal file
22
frontend/node_modules/antd/es/typography/hooks/useTooltipProps.js
generated
vendored
Normal 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;
|
||||
Reference in New Issue
Block a user