import * as React from "react";
import { Input } from "@alifd/next";
import { createElement } from 'react';
interface AltStringSetterProps {
  // 当前值
  value: string;
  // 默认值
  initialValue: string;
  // setter 唯一输出
  onChange: (val: string) => void;
  // AltStringSetter 特殊配置
  placeholder: string;
}
export default class AltStringSetter extends React.PureComponent<AltStringSetterProps> {
  componentDidMount() {
    const { onChange, value, defaultValue } = this.props;
    if (value == undefined && defaultValue) {
      onChange(defaultValue);
    }
  }

  // 声明 Setter 的 title
    static displayName = 'AltStringSetter';

  render() {
    const { onChange, value, placeholder,size } = this.props;
    return (
      <Input
        size={size}
        value={value}
        placeholder={placeholder || "图标类型"}
        onChange={(val: any) => onChange(val)}
      ></Input>
    );
  }
}