"use strict";
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
require("../../../../../../node_modules/element-plus/es/index.js");
;/* empty css                                                                */
;/* empty css                                                                     */
;/* empty css                                                                    */
;/* empty css                                                                        */
;/* empty css                                                                     */
;/* empty css                                                                                */
require("../../../../../../node_modules/element-plus/theme-chalk/el-date-picker.css.js");
const Vue = require("vue");
const index = require("../../../../../../node_modules/element-plus/es/components/date-picker/index.js");
const _hoisted_1 = { style: { "width": "100%" } };
const _sfc_main = /* @__PURE__ */ Object.assign({
  inheritAttrs: false
}, {
  __name: "Date",
  props: {
    config: {
      type: Object,
      required: true
    },
    modelValue: {
      type: null,
      default: ""
    },
    placeholder: {
      type: String,
      default: "请选择日期"
    },
    disabled: {
      type: Boolean,
      default: false
    },
    readonly: {
      type: Boolean,
      default: false
    },
    dateType: {
      type: String,
      default: "date"
      // date, week, month, year, datetime
    },
    // format: {
    //   type: String,
    //   default: "",
    // },
    // valueFormat: {
    //   type: String,
    //   default: "",
    // },
    startDate: {
      type: String,
      default: ""
    },
    endDate: {
      type: String,
      default: ""
    },
    dateRange: {
      type: String,
      default: ""
    }
  },
  emits: ["update:modelValue", "change"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const computedFormat = Vue.computed(() => {
      const formatMap = {
        date: "YYYY-MM-DD",
        week: "YYYY年第w周",
        month: "YYYY-MM",
        year: "YYYY",
        datetime: "YYYY-MM-DD HH:mm:ss"
      };
      return formatMap[props.dateType] || "YYYY-MM-DD";
    });
    const computedValueFormat = Vue.computed(() => {
      const valueFormatMap = {
        date: "YYYY/MM/DD",
        week: "YYYY/MM/DD",
        month: "YYYY/MM",
        year: "YYYY",
        datetime: "YYYY/MM/DD HH:mm:ss"
      };
      return valueFormatMap[props.dateType] || "YYYY/MM/DD";
    });
    const inputValue = Vue.computed({
      get: () => props.modelValue,
      set: (val) => {
        emit("update:modelValue", val);
        emit("change", val);
      }
    });
    const disabledDate = (date) => {
      if (!props.dateRange) return false;
      const today = /* @__PURE__ */ new Date();
      today.setHours(0, 0, 0, 0);
      const targetDate = new Date(date);
      targetDate.setHours(0, 0, 0, 0);
      if (props.dateRange === "beforeToday") {
        return targetDate > today;
      }
      if (props.dateRange === "afterToday") {
        return targetDate < today;
      }
      return false;
    };
    return (_ctx, _cache) => {
      const _component_el_date_picker = index.ElDatePicker;
      return Vue.openBlock(), Vue.createElementBlock("div", _hoisted_1, [
        Vue.createVNode(_component_el_date_picker, Vue.mergeProps({
          modelValue: inputValue.value,
          "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => inputValue.value = $event)
        }, Vue.toHandlers(__props.config.eventHandlers), {
          type: __props.dateType,
          placeholder: __props.placeholder,
          disabled: __props.disabled,
          readonly: __props.readonly,
          format: computedFormat.value,
          "value-format": computedValueFormat.value,
          "disabled-date": disabledDate,
          clearable: "",
          style: { "width": "100%" }
        }), null, 16, ["modelValue", "type", "placeholder", "disabled", "readonly", "format", "value-format"])
      ]);
    };
  }
});
exports.default = _sfc_main;
