mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-11-30 02:59:04 +08:00
docs: update faq (#44198)
* docs: update faq * chore: update lint * chore: update lint * chore: use returnType
This commit is contained in:
parent
56f2bc5072
commit
72b449a1a4
@ -16,7 +16,7 @@ const Category: React.FC<CategoryProps> = (props) => {
|
||||
const { icons, title, newIcons, theme } = props;
|
||||
const intl = useIntl();
|
||||
const [justCopied, setJustCopied] = React.useState<string | null>(null);
|
||||
const copyId = React.useRef<NodeJS.Timeout | null>(null);
|
||||
const copyId = React.useRef<ReturnType<typeof setTimeout> | null>(null);
|
||||
const onCopied = React.useCallback((type: string, text: string) => {
|
||||
message.success(
|
||||
<span>
|
||||
|
@ -32,7 +32,7 @@ const DocLayout: React.FC = () => {
|
||||
const location = useLocation();
|
||||
const { pathname, search, hash } = location;
|
||||
const [locale, lang] = useLocale(locales);
|
||||
const timerRef = useRef<NodeJS.Timeout | null>(null);
|
||||
const timerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
|
||||
const { direction } = useContext(SiteContext);
|
||||
const { loading } = useSiteData();
|
||||
|
||||
|
@ -139,7 +139,7 @@ const Header: React.FC = () => {
|
||||
searching: false,
|
||||
});
|
||||
const { direction, isMobile, updateSiteConfig } = useContext<SiteContextProps>(SiteContext);
|
||||
const pingTimer = useRef<NodeJS.Timeout | null>(null);
|
||||
const pingTimer = useRef<ReturnType<typeof setTimeout> | null>(null);
|
||||
const location = useLocation();
|
||||
const { pathname, search } = location;
|
||||
|
||||
|
@ -48,7 +48,7 @@ const ActionButton: React.FC<ActionButtonProps> = (props) => {
|
||||
};
|
||||
|
||||
React.useEffect(() => {
|
||||
let timeoutId: NodeJS.Timer | null = null;
|
||||
let timeoutId: ReturnType<typeof setTimeout> | null = null;
|
||||
if (autoFocus) {
|
||||
timeoutId = setTimeout(() => {
|
||||
buttonRef.current?.focus();
|
||||
|
@ -71,7 +71,7 @@ class InternalAffix extends React.Component<InternalAffixProps, AffixState> {
|
||||
|
||||
private fixedNodeRef = createRef<HTMLDivElement>();
|
||||
|
||||
private timer: NodeJS.Timeout | null;
|
||||
private timer: ReturnType<typeof setTimeout> | null;
|
||||
|
||||
context: ConfigConsumerProps;
|
||||
|
||||
|
@ -145,7 +145,7 @@ const InternalButton: React.ForwardRefRenderFunction<
|
||||
const needInserted = Children.count(children) === 1 && !icon && !isUnBorderedButtonType(type);
|
||||
|
||||
useEffect(() => {
|
||||
let delayTimer: NodeJS.Timer | null = null;
|
||||
let delayTimer: ReturnType<typeof setTimeout> | null = null;
|
||||
if (loadingOrDelay.delay > 0) {
|
||||
delayTimer = setTimeout(() => {
|
||||
delayTimer = null;
|
||||
|
@ -296,8 +296,8 @@ Provide linkage between forms. If a sub form with `name` prop update, it will au
|
||||
| resetFields | Reset fields to `initialValues` | (fields?: [NamePath](#namepath)\[]) => void | |
|
||||
| scrollToField | Scroll to field position | (name: [NamePath](#namepath), options: \[[ScrollOptions](https://github.com/stipsan/scroll-into-view-if-needed/tree/ece40bd9143f48caf4b99503425ecb16b0ad8249#options)]) => void | |
|
||||
| setFields | Set fields status | (fields: [FieldData](#fielddata)\[]) => void | |
|
||||
| setFieldValue | Set fields value(Will directly pass to form store. If you do not want to modify passed object, please clone first) | (name: [NamePath](#namepath), value: any) => void | 4.22.0 |
|
||||
| setFieldsValue | Set fields value(Will directly pass to form store. If you do not want to modify passed object, please clone first). Use `setFieldValue` instead if you want to only config single value in Form.List | (values) => void | |
|
||||
| setFieldValue | Set fields value(Will directly pass to form store and **reset validation message**. If you do not want to modify passed object, please clone first) | (name: [NamePath](#namepath), value: any) => void | 4.22.0 |
|
||||
| setFieldsValue | Set fields value(Will directly pass to form store and **reset validation message**. If you do not want to modify passed object, please clone first). Use `setFieldValue` instead if you want to only config single value in Form.List | (values) => void | |
|
||||
| submit | Submit the form. It's same as click `submit` button | () => void | |
|
||||
| validateFields | Validate fields | (nameList?: [NamePath](#namepath)\[], { validateOnly?: boolean }) => Promise | `validateOnly`: 5.5.0 |
|
||||
|
||||
|
@ -295,8 +295,8 @@ Form.List 渲染表单相关操作函数。
|
||||
| resetFields | 重置一组字段到 `initialValues` | (fields?: [NamePath](#namepath)\[]) => void | |
|
||||
| scrollToField | 滚动到对应字段位置 | (name: [NamePath](#namepath), options: [ScrollOptions](https://github.com/stipsan/scroll-into-view-if-needed/tree/ece40bd9143f48caf4b99503425ecb16b0ad8249#options)) => void | |
|
||||
| setFields | 设置一组字段状态 | (fields: [FieldData](#fielddata)\[]) => void | |
|
||||
| setFieldValue | 设置表单的值(该值将直接传入 form store 中。如果你不希望传入对象被修改,请克隆后传入) | (name: [NamePath](#namepath), value: any) => void | 4.22.0 |
|
||||
| setFieldsValue | 设置表单的值(该值将直接传入 form store 中。如果你不希望传入对象被修改,请克隆后传入)。如果你只想修改 Form.List 中单项值,请通过 `setFieldValue` 进行指定 | (values) => void | |
|
||||
| setFieldValue | 设置表单的值(该值将直接传入 form store 中并且**重置错误信息**。如果你不希望传入对象被修改,请克隆后传入) | (name: [NamePath](#namepath), value: any) => void | 4.22.0 |
|
||||
| setFieldsValue | 设置表单的值(该值将直接传入 form store 中并且**重置错误信息**。如果你不希望传入对象被修改,请克隆后传入)。如果你只想修改 Form.List 中单项值,请通过 `setFieldValue` 进行指定 | (values) => void | |
|
||||
| submit | 提交表单,与点击 `submit` 按钮效果相同 | () => void | |
|
||||
| validateFields | 触发表单验证 | (nameList?: [NamePath](#namepath)\[], { validateOnly?: boolean }) => Promise | `validateOnly`: 5.5.0 |
|
||||
|
||||
|
@ -5,7 +5,7 @@ export default function useRemovePasswordTimeout(
|
||||
inputRef: React.RefObject<InputRef>,
|
||||
triggerOnMount?: boolean,
|
||||
) {
|
||||
const removePasswordTimeoutRef = useRef<NodeJS.Timer[]>([]);
|
||||
const removePasswordTimeoutRef = useRef<ReturnType<typeof setTimeout>[]>([]);
|
||||
const removePasswordTimeout = () => {
|
||||
removePasswordTimeoutRef.current.push(
|
||||
setTimeout(() => {
|
||||
|
@ -31,7 +31,7 @@ export default function confirm(config: ModalFuncProps) {
|
||||
const container = document.createDocumentFragment();
|
||||
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
||||
let currentConfig = { ...config, close, open: true } as any;
|
||||
let timeoutId: NodeJS.Timeout;
|
||||
let timeoutId: ReturnType<typeof setTimeout>;
|
||||
|
||||
function destroy(...args: any[]) {
|
||||
const triggerCancel = args.some((param) => param && param.triggerCancel);
|
||||
|
@ -24,7 +24,7 @@ const Countdown: React.FC<CountdownProps> = (props) => {
|
||||
|
||||
const forceUpdate = useForceUpdate();
|
||||
|
||||
const countdown = React.useRef<NodeJS.Timer | null>(null);
|
||||
const countdown = React.useRef<ReturnType<typeof setTimeout> | null>(null);
|
||||
|
||||
const stopTimer = () => {
|
||||
onFinish?.();
|
||||
|
@ -193,7 +193,7 @@ const Base = React.forwardRef<HTMLElement, BlockProps>((props, ref) => {
|
||||
// ========================== Copyable ==========================
|
||||
const [enableCopy, copyConfig] = useMergedConfig<CopyConfig>(copyable);
|
||||
const [copied, setCopied] = React.useState(false);
|
||||
const copyIdRef = React.useRef<NodeJS.Timeout | null>(null);
|
||||
const copyIdRef = React.useRef<ReturnType<typeof setTimeout> | null>(null);
|
||||
|
||||
const copyOptions: Pick<CopyConfig, 'format'> = {};
|
||||
if (copyConfig.format) {
|
||||
|
Loading…
Reference in New Issue
Block a user