import snippets from './snippets';

export default {
  snippets,
  componentName: 'PisellQRScanner',
  title: '二维码扫描器',
  category: '数据录入',
  docUrl: '',
  screenshot: '',
  devMode: 'proCode',
  npm: {
    package: '@pisell/materials',
    version: '1.0.3',
    exportName: 'PisellQRScanner',
    main: 'src/index.tsx',
    destructuring: true,
    subName: ''
  },
  props: [
    {
      name: 'visible',
      title: { label: '是否可见', tip: '控制扫码界面是否可见' },
      propType: 'bool',
      defaultValue: false,
      setter: 'BoolSetter'
    },
    {
      name: 'showUpload',
      title: { label: '显示上传图片', tip: '是否显示上传图片按钮，默认开启' },
      propType: 'bool',
      defaultValue: true,
      setter: 'BoolSetter'
    },
    {
      name: 'onClose',
      title: { label: '关闭回调', tip: '扫码界面关闭时的回调函数' },
      propType: 'func',
      setter: {
        componentName: 'FunctionSetter',
        props: {
          template: '() => {\n  // 处理关闭事件\n}',
        },
      },
    },
    {
      name: 'onScan',
      title: { label: '扫码成功回调', tip: '扫码成功时的回调函数，参数为扫描结果字符串' },
      propType: 'func',
      setter: {
        componentName: 'FunctionSetter',
        props: {
          template: '(result) => {\n  // 处理扫描结果\n  console.log(\'扫描结果:\', result);\n}',
        },
      },
    },
    {
      name: 'className',
      title: { label: '类名', tip: '自定义类名' },
      propType: 'string',
      setter: 'StringSetter'
    },
    {
      name: 'style',
      title: { label: '样式', tip: '自定义样式' },
      propType: 'object',
      setter: 'StyleSetter'
    }
  ],
  configure: {
    component: {
      isContainer: false
    },
    supports: {
      style: true,
      className: true
    },
    events: {
      onScan: {
        description: '扫码成功时触发',
      },
      onClose: {
        description: '扫码界面关闭时触发',
      }
    }
  }
}; 