'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var vue = require('vue');
require('../../../../../../utils/index.js');
require('../../../../base/datePicker/index.js');
var useWatchModelChange = require('../../composables/useWatchModelChange.js');
var searchFormDatePicker = require('./searchFormDatePicker.js');
var event = require('../../../../../../utils/src/elementPlus/event.js');
var datePicker = require('../../../../base/datePicker/datePicker.js');
var dateShortcuts = require('../../../../../../utils/src/date/dateShortcuts.js');

var _sfc_main = /* @__PURE__ */ vue.defineComponent({
  ...{
    name: searchFormDatePicker.SearchFormDatePickerName
  },
  __name: "SearchFormDatePicker",
  props: /* @__PURE__ */ vue.mergeModels(searchFormDatePicker.searchFormDatePickerProps, {
    "modelValue": {},
    "modelModifiers": {}
  }),
  emits: /* @__PURE__ */ vue.mergeModels(searchFormDatePicker.searchFormDatePickerEmits, ["update:modelValue"]),
  setup(__props, { emit: __emit }) {
    const modelValue = vue.useModel(__props, "modelValue");
    const props = __props;
    const emit = __emit;
    const datePickerEvents = event.getGmEvent(datePicker.datePickerEmits, emit);
    useWatchModelChange.useWatchModelChange(modelValue, { prop: props.prop, noDefaultSync: props.noDefaultSync });
    const shortcutList = vue.computed(() => Array.isArray(props.shortcuts) ? props.shortcuts : dateShortcuts.getDateShortcuts(props.type));
    const valueFormat = vue.computed(() => props.valueFormat ?? (props.type === "datetimerange" ? "YYYY-MM-DD HH:mm:ss" : "YYYY-MM-DD"));
    const defaultTime = vue.computed(
      () => props.defaultTime ?? (props.type === "datetimerange" ? [new Date(2e3, 0, 1, 0, 0, 0), new Date(2e3, 0, 1, 23, 59, 59)] : void 0)
    );
    return (_ctx, _cache) => {
      const _component_gm_date_picker = vue.resolveComponent("gm-date-picker");
      const _component_gm_form_item = vue.resolveComponent("gm-form-item");
      return vue.openBlock(), vue.createBlock(_component_gm_form_item, { prop: _ctx.prop }, {
        default: vue.withCtx(() => [
          vue.createVNode(_component_gm_date_picker, vue.mergeProps({
            modelValue: modelValue.value,
            "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => modelValue.value = $event),
            type: _ctx.type,
            "range-separator": "-",
            "value-format": valueFormat.value,
            clearable: "",
            disabled: _ctx.disabled,
            placeholder: _ctx.label,
            "start-placeholder": _ctx.startPlaceholder ?? `${_ctx.label}\u5F00\u59CB\u65E5\u671F`,
            "end-placeholder": _ctx.endPlaceholder ?? `${_ctx.label}\u7ED3\u675F\u65E5\u671F`,
            style: {
              "--el-date-editor-width": "100%"
            },
            shortcuts: shortcutList.value,
            defaultValue: _ctx.defaultValue,
            defaultTime: defaultTime.value
          }, vue.toHandlers(vue.unref(datePickerEvents))), null, 16, ["modelValue", "type", "value-format", "disabled", "placeholder", "start-placeholder", "end-placeholder", "shortcuts", "defaultValue", "defaultTime"])
        ]),
        _: 1
        /* STABLE */
      }, 8, ["prop"]);
    };
  }
});

exports.default = _sfc_main;
//# sourceMappingURL=SearchFormDatePicker.vue2.js.map
