import { WidgetType } from '../constant'
import { positionConfig } from './base'

export default {
  type: WidgetType.MARQUEE,
  label: '滚动文本',
  icon: 'w-marquee',
  defaults (scale) {
    return {
      top: 0,
      left: 0,
      width: 200 * scale.width | 0,
      height: 80 * scale.height | 0,
      text: '滚动文本',
      color: '#FFFFFF',
      fontSize: 48 * scale.height | 0,
      fontWeight: 'normal',
      backgroundColor: 'rgba(0, 0, 0, 0)',
      refreshRate: 50,
      step: 2
    }
  },
  transform: {
    color: ['color', 'backgroundColor']
  },
  options: [
    {
      label: '配置',
      list: [
        {
          key: 'text',
          label: '文本',
          type: 'textarea',
          options: {
            singleLine: true
          }
        },
        {
          key: 'color',
          label: '字体颜色',
          type: 'color'
        },
        {
          key: 'fontSize',
          label: '字体大小',
          type: 'number',
          options: {
            min: 12
          }
        },
        {
          key: 'fontWeight',
          label: '字体粗细',
          type: 'select',
          options: {
            options: [
              { value: 'normal', label: '正常' },
              { value: 'bold', label: '粗体' },
              { value: 'bolder', label: '特粗体' },
              { value: 'lighter', label: '细体' }
            ]
          }
        },
        {
          key: 'backgroundColor',
          label: '背景色',
          type: 'color'
        },
        {
          key: 'refreshRate',
          label: '刷新频率',
          type: 'number',
          options: {
            min: 1,
            max: 120
          }
        },
        {
          key: 'step',
          label: '步长',
          type: 'number',
          options: {
            min: 1,
            step: 0.01
          }
        }
      ]
    },
    positionConfig
  ]
}
