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

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

export class NumberStrategy extends BaseFieldStrategy {
  supportsReadonly = false; // InputNumber 不支持 readOnly

  render(context: FieldRenderContext): React.ReactNode {
    const { field, value, onChange } = context;
    const disabledProps = this.getDisabledProps(context);
    
    return (
      <InputNumber
        style={{ width: '100%' }}
        placeholder={field.placeholder}
        {...disabledProps}
        min={field.min}
        max={field.max}
        value={value}
        onChange={onChange}
      />
    );
  }
}

