import snippets from './snippets';
import baseInputMeta from '../pisell-input/meta';

export default {
  snippets,
  componentName: 'PisellInput.SecurityCode',
  title: '输入安全码',
  category: '表单',
  docUrl: '',
  screenshot: '',
  devMode: 'proCode',
  npm: {
    package: '@pisell/materials',
    version: '1.0.1',
    exportName: 'PisellInput',
    main: 'src/index.tsx',
    destructuring: true,
    subName: 'SecurityCode',
  },
  props: [
    {
      name: 'maxLength',
      title: { label: 'CVC位数', tip: 'CVC位数' },
      setter: {
        componentName: 'RadioGroupSetter',
        props: {
          options: [
            {
              title: '3位',
              value: 3,
            },
            {
              title: '4位',
              value: 4,
            },
          ],
        },
      },
      propType: { type: 'oneOf', value: [3, 4] },
      defaultValue: 3,
    },
    {
      name: 'showCVCIcon',
      title: { label: '显示CVC提示Icon', tip: '是否显示CVC提示Icon' },
      propType: 'bool',
      defaultValue: true,
      setter: 'BoolSetter',
    },
    ...(baseInputMeta.props.filter(item => item.name !== 'maxLength'))],
  configure: {
    supports: {
      style: true,
      events: [
        {
          name: 'onChange',
          template:
            "onChange(event,${extParams}){\n// 输入框内容变化时的回调\nconsole.log('onChange',event);}",
        },
        {
          name: 'onPressEnter',
          template:
            "onPressEnter(event,${extParams}){\n// 按下回车的回调\nconsole.log('onPressEnter',event);}",
        },
        {
          name: 'onFocus',
          template:
            "onFocus(event,${extParams}){\n// 获取焦点回调\nconsole.log('onFocus',event);}",
        },
        {
          name: 'onKeyDown',
          template:
            "onKeyDown(event,${extParams}){\n// 按键按下时的回调\nconsole.log('onKeyDown',event);}",
        },
        {
          name: 'onKeyPress',
          template:
            "onKeyPress(event,${extParams}){\n// 按键按下后的回调\nconsole.log('onKeyPress',event);}",
        },
        {
          name: 'onKeyUp',
          template:
            "onKeyUp(event,${extParams}){\n// 按键释放回调\nconsole.log('onKeyUp',event);}",
        },
        {
          name: 'onBlur',
          template:
            "onBlur(event,${extParams}){\n// 按键释放回调\nconsole.log('onBlur',event);}",
        },
      ],
    },
  },
};
