import snippets from './snippets';

export default {
  snippets,
  componentName: 'PisellRating',
  title: '评分',
  category: '表单',
  docUrl: '',
  screenshot: '',
  devMode: 'proCode',
  npm: {
    package: '@pisell/materials',
    version: '1.0.1',
    exportName: 'PisellRating',
    main: 'src/index.tsx',
    destructuring: true,
    subName: '',
  },
  configure: {
    props: [
      {
        title: { label: { type: 'i18n', 'en-US': 'Basic', 'zh-CN': '基础配置' } },
        display: 'block',
        type: 'group',
        items: [
          {
            name: 'mode',
            title: { label: '状态模式', tip: 'mode | 组件的状态模式' },
            propType: { type: 'oneOf', value: ['read', 'edit'] },
            setter: [
              {
                componentName: 'RadioGroupSetter',
                props: {
                  options: [
                    { title: '只读', value: 'read' },
                    { title: '编辑', value: 'edit' },
                  ],
                },
              },
              'VariableSetter',
            ],
            defaultValue: 'edit',
          },
          {
            name: 'value',
            title: { label: '当前值', tip: 'value | 当前评分值' },
            propType: 'number',
            setter: ['NumberSetter', 'VariableSetter'],
          },
          {
            name: 'max',
            title: { label: '星星数量', tip: 'max | 星星数量' },
            propType: 'number',
            setter: ['NumberSetter', 'VariableSetter'],
            defaultValue: 5,
          },
          {
            name: 'allowHalf',
            title: { label: '允许半星', tip: 'allowHalf | 是否允许半星评分' },
            propType: 'bool',
            setter: ['BoolSetter', 'VariableSetter'],
            defaultValue: false,
          },
          {
            name: 'allowClear',
            title: { label: '允许清除', tip: 'allowClear | 是否允许清除评分' },
            propType: 'bool',
            setter: ['BoolSetter', 'VariableSetter'],
            defaultValue: true,
          },
          {
            name: 'disabled',
            title: { label: '是否禁用', tip: 'disabled | 是否禁用' },
            propType: 'bool',
            setter: ['BoolSetter', 'VariableSetter'],
            defaultValue: false,
          },
        ],
      },
      {
        title: { label: { type: 'i18n', 'en-US': 'Display', 'zh-CN': '展示配置' } },
        display: 'block',
        type: 'group',
        items: [
          {
            name: 'showValue',
            title: { label: '显示数值', tip: 'showValue | 是否显示评分数值' },
            propType: 'bool',
            setter: ['BoolSetter', 'VariableSetter'],
            defaultValue: false,
          },
          {
            name: 'showCount',
            title: { label: '显示人数', tip: 'showCount | 是否显示评分人数' },
            propType: 'bool',
            setter: ['BoolSetter', 'VariableSetter'],
            defaultValue: false,
          },
          {
            name: 'reviewCount',
            title: { label: '评分人数', tip: 'reviewCount | 评分人数' },
            propType: 'number',
            setter: ['NumberSetter', 'VariableSetter'],
          },
          {
            name: 'size',
            title: { label: '星星尺寸', tip: 'size | 星星大小（像素）' },
            propType: 'number',
            setter: ['NumberSetter', 'VariableSetter'],
            defaultValue: 20,
          },
        ],
      },
    ],
    supports: {
      style: true,
      events: [
        {
          name: 'onChange',
          template: "onChange(value,${extParams}){\nconsole.log('onChange', value);}",
        },
        {
          name: 'onHoverChange',
          template: "onHoverChange(value,${extParams}){\nconsole.log('onHoverChange', value);}",
        },
      ],
    },
    component: {},
  },
};
