index.tsx 791 Bytes

import { Field } from '@formily/react';
import { FormItem, Input } from '@formily/antd-v5';
import cx from 'classnames';
import './index.less';
import { FieldProps } from '../../typings';

const TextInput: React.FC<FieldProps> = (props) => {
  const { name, title, validator = [], decoratorProps, componentProps, ...args } = props;

  return (
    <div className={cx('global_text')}>
      <Field
        {...props}
        name={name}
        title={title}
        {...args}
        decorator={[FormItem, { ...decoratorProps }]}
        component={[
          Input,
          {
            allowClear: true,
            ...componentProps,
            componenttypename: 'Input',
          },
        ]}
        validator={validator}
      />
    </div>
  );
};

export default TextInput;