import {getToken} from "@/utils/auth";

export const addPropsMap = new Map([
  ["text", {
    clearable: true
  }],
  ["richtext",{}],
  ['radio',{
    clearable: true
  }],
  ["checkbox", {
    collapseTags: true,
    multiple: true,
    clearable: true
  }],
  ["date", {
    clearable: true,
    valueFormat: 'yyyy-MM-dd'
  }],
  ["datetime", {
    type: 'datetime',
    clearable: true,
    valueFormat: 'yyyy-MM-dd mm:hh:ss',
    pickerOptions: {
      shortcuts: [{
        text: '今天',
        onClick(picker) {
          picker.$emit('pick', new Date());
        }
      }, {
        text: '昨天',
        onClick(picker) {
          const date = new Date();
          date.setTime(date.getTime() - 3600 * 1000 * 24);
          picker.$emit('pick', date);
        }
      }, {
        text: '一周前',
        onClick(picker) {
          const date = new Date();
          date.setTime(date.getTime() - 3600 * 1000 * 24 * 7);
          picker.$emit('pick', date);
        }
      }]
    }
  }],
  ["file",{
    action: process.env.VUE_APP_UPLOAD_API,
    headers: {
      Authorization: `Bearer ${getToken()}`,
    },
    autoUpload: false,
    multiple: false,
    limit: 1
  }],
  ["files",{
    action: process.env.VUE_APP_UPLOAD_API,
    headers: {
      Authorization: `Bearer ${getToken()}`,
    },
    autoUpload: false,
    multiple: true
  }],
  ["textarea", {
    clearable: true,
    type: 'textarea',
    autosize: {
      'minRows': 2
    }
  }],


  ["map", "el-input"],
])
