<template>
  <el-form-item :label="i18nt('designer.setting.displayType')">
    <el-select v-model="optionModel.type" @change="changeType">
      <el-option label="daterange" value="daterange"></el-option>
      <el-option label="datetimerange" value="datetimerange"></el-option>
      <el-option label="monthrange" value="monthrange"></el-option>
    </el-select>
  </el-form-item>
</template>

<script>
  import i18n from "../../../../../../components/xform/utils/i18n";

  export default {
    name: "date-range-type-editor",
    mixins: [i18n],
    props: {
      designer: Object,
      selectedWidget: Object,
      optionModel: Object,
    },
    methods: {
      changeType(val) {
        let formatMap = {
          datetimerange: "yyyy-MM-dd HH:mm:ss",
          daterange: "yyyy-MM-dd",
          monthrange: "yyyy-MM"
        }
        let value = formatMap[val];
        this.optionModel.format = value;
        this.optionModel.valueFormat = value;
      }
    }
  }
</script>

<style lang="scss" scoped>

</style>
