/* eslint-disable max-lines-per-function, react-hooks/rules-of-hooks, prefer-const, max-len */ import React, { useState, useLayoutEffect, useMemo, useRef, forwardRef } from 'react'; import classNames from 'classnames'; import { cssClasses } from '@douyinfe/semi-foundation/form/constants'; import { isValid, generateValidatesFromRules, mergeOptions, mergeProps, getDisplayName } from '@douyinfe/semi-foundation/form/utils'; import * as ObjectUtil from '@douyinfe/semi-foundation/utils/object'; import isPromise from '@douyinfe/semi-foundation/utils/isPromise'; import warning from '@douyinfe/semi-foundation/utils/warning'; import { useFormState, useStateWithGetter, useFormUpdater, useArrayFieldState } from '../hooks/index'; import ErrorMessage from '../errorMessage'; import { isElement } from '../../_base/reactUtils'; import Label from '../label'; import { Col } from '../../grid'; import { CallOpts, WithFieldOption } from '@douyinfe/semi-foundation/form/interface'; import { CommonFieldProps, CommonexcludeType } from '../interface'; import { Subtract } from 'utility-types'; import { noop } from "lodash"; const prefix = cssClasses.PREFIX; /** * withFiled is used to inject components * 1. Takes over the value and onChange of the component and synchronizes them to Form Foundation * 2. Insert