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

export default {
  type: WidgetType.TIME,
  label: '时间',
  icon: 'w-time',
  defaults (scale) {
    return {
      top: 0,
      left: 0,
      width: 420 * scale.width | 0,
      height: 80 * scale.height | 0,
      color: '#FFFFFF',
      fontSize: 48 * scale.height | 0,
      fontWeight: 'normal',
      textAlign: 'center',
      format: 'yyyy-MM-dd HH:mm'
    }
  },
  transform: {
    color: ['color']
  },
  options: [
    {
      label: '配置',
      list: [
        {
          key: 'format',
          label: '格式',
          type: 'select',
          options: {
            options: [
              { value: 'yyyy-MM-dd', label: '1970-01-01' },
              { value: 'yyyy-MM-dd HH:mm', label: '1970-01-01 23:59' },
              { value: 'yyyy-MM-dd HH:mm:ss', label: '1970-01-01 23:59:59' },
              { value: 'MM-dd', label: '01-01' },
              { value: 'HH:mm', label: '23:59' },
              { value: 'HH:mm:ss', label: '23:59:59' },
              { value: 'yyyy-MM-dd w', label: '1970-01-01 星期一' },
              { value: 'yyyy-MM-dd w  HH:mm', label: '1970-01-01 星期一  23:59:59' },
              { value: 'w', label: '星期一' }
            ]
          }
        },
        {
          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: 'textAlign',
          label: '对齐方式',
          type: 'select',
          options: {
            options: [
              { value: 'center', label: '居中' },
              { value: 'left', label: '左对齐' },
              { value: 'right', label: '右对齐' }
            ]
          }
        }
      ]
    },
    positionConfig
  ]
}
