/**
 * Input 字段渲染策略
 */

import React from 'react';
import { Input } from 'antd';
import { BaseFieldStrategy } from './BaseFieldStrategy';
import type { FieldRenderContext } from '../IFieldRenderStrategy';

export class InputStrategy extends BaseFieldStrategy {
  supportsReadonly = true;

  render(context: FieldRenderContext): React.ReactNode {
    const { field, value, onChange, isReadonly, readonlyStyle } = context;
    const disabledProps = this.getDisabledProps(context);
    
    return (
      <Input
        placeholder={field.placeholder}
        {...disabledProps}
        style={isReadonly ? readonlyStyle : undefined}
        value={value}
        onChange={(e) => onChange?.(e.target.value)}
      />
    );
  }
}

