/**
 * tdesign v0.39.1-alpha.1
 * (c) 2022 tdesign
 * @license MIT
 */

'use strict';

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

var helper = require('../_chunks/dep-33ee4bce.js');
var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
var dayjs = require('dayjs');
var _commonjsHelpers = require('../_chunks/dep-7ed6a5c6.js');
var tdesignIconsVue = require('tdesign-icons-vue');
var config = require('../config.js');
var datePicker_props = require('./props.js');
var utils_classnames = require('../utils/classnames.js');
var button_index = require('../button/index.js');
var input_index = require('../input/index.js');
var popup_index = require('../popup/index.js');
var utils_mixins = require('../utils/mixins.js');
var configProvider_configReceiver = require('../config-provider/config-receiver.js');
var datePicker_calendarPresets = require('./calendar-presets.js');
var datePicker_panel_date = require('./panel/date.js');
var datePicker_panel_dateRange = require('./panel/date-range.js');
var timePicker_panel_index = require('../time-picker/panel/index.js');
var timePicker_interface = require('../time-picker/interface.js');
var _common_js_datePicker_utils = require('../_common/js/date-picker/utils.js');
var utils_renderTnode = require('../utils/render-tnode.js');
require('../button/button.js');
require('../loading/index.js');
require('../loading/loading.js');
require('vue');
require('../loading/icon/gradient.js');
require('../_common/js/loading/circle-adapter.js');
require('../_common/js/utils/set-style.js');
require('../_common/js/utils/helper.js');
require('@babel/runtime/helpers/objectWithoutProperties');
require('../utils/dom.js');
require('raf');
require('lodash/isString');
require('../utils/easing.js');
require('../utils/transfer-dom.js');
require('../loading/props.js');
require('../utils/withInstall.js');
require('lodash/capitalize');
require('../loading/plugin.js');
require('@babel/runtime/helpers/typeof');
require('lodash/isObject');
require('../button/props.js');
require('../utils/ripple.js');
require('lodash/mergeWith');
require('../config-provider/context.js');
require('lodash/merge');
require('../_common/js/global-config/default-config.js');
require('../_common/js/global-config/locale/zh_CN.js');
require('../input/addon.js');
require('../input/input.js');
require('@babel/runtime/helpers/toConsumableArray');
require('lodash/camelCase');
require('lodash/kebabCase');
require('../utils/helper.js');
require('../utils/event.js');
require('../input/props.js');
require('../input/input-group.js');
require('../utils/map-props.js');
require('../popup/popup.js');
require('@popperjs/core');
require('../popup/props.js');
require('../popup/container.js');
require('./basic/header.js');
require('./basic/table.js');
require('./basic/cell.js');
require('../_chunks/dep-058e10f7.js');
require('lodash/debounce');
require('../time-picker/panel/props.js');
require('../time-picker/props.js');
require('../time-picker/constant.js');
require('@babel/runtime/helpers/extends');
require('lodash/chunk');

function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

var _slicedToArray__default = /*#__PURE__*/_interopDefaultLegacy(_slicedToArray);
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
var dayjs__default = /*#__PURE__*/_interopDefaultLegacy(dayjs);

var isBetween = _commonjsHelpers.createCommonjsModule(function (module, exports) {
  !function (e, i) {
    module.exports = i() ;
  }(_commonjsHelpers.commonjsGlobal, function () {

    return function (e, i, t) {
      i.prototype.isBetween = function (e, i, s, f) {
        var n = t(e),
            o = t(i),
            r = "(" === (f = f || "()")[0],
            u = ")" === f[1];
        return (r ? this.isAfter(n, s) : !this.isBefore(n, s)) && (u ? this.isBefore(o, s) : !this.isAfter(o, s)) || (r ? this.isBefore(n, s) : !this.isAfter(n, s)) && (u ? this.isAfter(o, s) : !this.isBefore(o, s));
      };
    };
  });
});

function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
dayjs__default["default"].extend(isBetween);
var name = "".concat(config.prefix, "-date-picker");
var _DatePicker = utils_mixins["default"](configProvider_configReceiver["default"]("datePicker")).extend({
  name: "TDatePicker",
  components: {
    CalendarIcon: tdesignIconsVue.CalendarIcon,
    TimeIcon: tdesignIconsVue.TimeIcon,
    TPopup: popup_index.Popup,
    TButton: button_index.Button,
    TInput: input_index.Input,
    CalendarPresets: datePicker_calendarPresets["default"],
    TDate: datePicker_panel_date["default"],
    TDateRange: datePicker_panel_dateRange["default"],
    TTimePickerPanel: timePicker_panel_index["default"]
  },
  props: _objectSpread({}, datePicker_props["default"]),
  data: function data() {
    return {
      tempValue: "",
      monthDate: new Date(),
      start: new Date(),
      end: new Date(),
      selectedDates: [],
      inSelection: false,
      inline: false,
      dateFormat: "",
      multiSeparator: ",",
      inlineView: false,
      showTime: false,
      isOpen: false,
      formDisabled: void 0,
      startTimeValue: dayjs__default["default"](),
      endTimeValue: dayjs__default["default"]()
    };
  },
  computed: {
    inputListeners: function inputListeners() {
      return _objectSpread(_objectSpread({}, this.$listeners), {}, {
        focus: this.onNativeFocus,
        input: this.onNativeInput,
        click: this.onClick
      });
    },
    startText: function startText() {
      return this.formatDate(this.start);
    },
    endText: function endText() {
      return this.formatDate(this.end);
    },
    formattedValue: {
      get: function get() {
        var vm = this;
        var tempValue = vm.tempValue,
            range = vm.range,
            mode = vm.mode,
            isOpen = vm.isOpen,
            startText = vm.startText,
            endText = vm.endText,
            global = vm.global,
            outValue = vm.value;
        var selectedDates = vm.getDates(outValue);
        var selectedFmtDates = selectedDates.map(function (d) {
          return vm.formatDate(d);
        });

        if (tempValue) {
          return tempValue;
        }

        var strMode = range ? "range" : mode;
        var value = "";

        switch (strMode) {
          case "time":
          case "date":
          case "month":
          case "year":
            value = selectedFmtDates.join("");
            break;

          case "range":
            if (isOpen) {
              value = [startText, endText].join(global.rangeSeparator);
            } else if (selectedFmtDates.length > 1) {
              value = [selectedFmtDates[0], selectedFmtDates[1]].join(global.rangeSeparator);
            }

            break;
        }

        return value;
      },
      set: function set(value) {
        var vm = this;
        var min = vm.min,
            dateFormat = vm.dateFormat;

        if (value) {
          if (String(value).length >= String(vm.formatDate(min || new Date())).length && dayjs__default["default"](value, dateFormat)) {
            vm.tempValue = "";
            vm.setDate(value, true);
          } else {
            vm.tempValue = value;
          }
        }
      }
    },
    rangeText: {
      get: function get() {
        var vm = this;
        var range = vm.startText;

        if (vm.range) {
          range += " ".concat(vm.global.rangeSeparator, " ").concat(vm.endText);
        }

        return range;
      },
      set: function set(value) {
        var vm = this;

        if (vm.value) {
          vm.setDate(value, false);
        }
      }
    },
    min: function min() {
      var disableDate = this.disableDate || {};
      var before = disableDate.before;
      return before ? new Date(before) : null;
    },
    max: function max() {
      var disableDate = this.disableDate || {};
      var after = disableDate.after;
      return after ? new Date(after) : null;
    },
    classes: function classes() {
      var _ref;

      return [name, utils_classnames["default"].SIZE[this.size] || "", (_ref = {}, _defineProperty__default["default"](_ref, "".concat(name, "--month-picker"), this.mode === "year" || this.mode === "month"), _defineProperty__default["default"](_ref, "".concat(config.prefix, "-inline"), this.inline || this.inlineView), _ref)];
    },
    pickerStyles: function pickerStyles() {
      var _ref2;

      return _ref2 = {}, _defineProperty__default["default"](_ref2, "".concat(name, "__container"), true), _defineProperty__default["default"](_ref2, "".concat(name, "-picker--open"), this.isOpen || this.inlineView), _defineProperty__default["default"](_ref2, "".concat(name, "--calendar-inline-view"), this.inlineView), _defineProperty__default["default"](_ref2, "".concat(name, "--range"), this.range), _ref2;
    },
    tDisabled: function tDisabled() {
      return this.formDisabled || this.disabled;
    }
  },
  mounted: function mounted() {
    this.attachDatePicker();
  },
  methods: {
    handleTInputFocus: function handleTInputFocus() {
      this.$refs["native"].blur();
    },
    handleTimePick: function handleTimePick(col, time, index) {
      if (!this.range || index === 0) {
        var start = new Date(this.start);
        start["set".concat(_common_js_datePicker_utils.firstUpperCase(col), "s")](time);
        this.start = start;
        this.startTimeValue = dayjs__default["default"](start);
        this.dateClick(new Date(start));
      } else {
        var end = new Date(this.end);
        end["set".concat(_common_js_datePicker_utils.firstUpperCase(col), "s")](time);
        this.end = end;
        this.endTimeValue = dayjs__default["default"](end);
        this.dateClick(new Date(end));
      }
    },
    attachDatePicker: function attachDatePicker() {
      var startDate = new Date();
      var endDate = new Date();
      this.dateFormat = this.format || this.global.format;
      var start = new Date(startDate);
      var end = new Date(endDate);

      if (!this.range) {
        end = new Date(startDate);
      }

      this.start = start;
      this.end = end;
      var val = this.value || this.defaultValue || "";
      this.setDate(val, false);

      if (this.inlineView) {
        this.open();
      }
    },
    onNativeInput: function onNativeInput(event) {
      var val = event.target.value;
      this.formattedValue = val;
      var d1 = this.parseDate(val);

      if (d1 instanceof Date) {
        var d2 = this.formatDate(d1);
        this.$emit("input", d2);
      }
    },
    onNativeFocus: function onNativeFocus(event) {
      if (!this.isOpen) {
        this.open();
      }

      this.$emit("focus", event);
    },
    onClick: function onClick(event) {
      if (!this.isOpen) {
        this.open();
      }

      this.$emit("click", event);
    },
    normalizeDateTime: function normalizeDateTime(value, oldValue) {
      var newDate = dayjs__default["default"](value);
      var oldDate = dayjs__default["default"](oldValue);

      if (this.enableTimePicker) {
        newDate.hour(oldDate.hour());
        newDate.minute(oldDate.minute());
        newDate.second(oldDate.second());
        newDate.millisecond(oldDate.millisecond());
      }

      return newDate.toDate();
    },
    dateClick: function dateClick(value) {
      var mode = this.range ? "range" : this.mode;

      if (this.showTime) {
        mode = "time";
      }

      switch (mode) {
        case "time":
          this.selectedDates = this.range ? [this.start, this.end] : [value];
          this.clickedApply(false);
          break;

        case "year":
        case "month":
        case "date":
          this.start = this.normalizeDateTime(value, this.start);
          this.selectedDates = [this.start];
          this.clickedApply(!this.enableTimePicker);
          break;

        case "range":
          if (this.inSelection) {
            this.inSelection = false;
            this.start = this.normalizeDateTime(value[0], this.end);
            this.end = this.normalizeDateTime(value[1], this.end);

            if (this.end < this.start) {
              this.inSelection = true;
              this.start = this.normalizeDateTime(value[0], this.start);
            }
          } else {
            this.start = this.normalizeDateTime(value[0], this.start);
            this.end = this.normalizeDateTime(value[1], this.end);
            this.inSelection = true;
          }

          this.clickedApply(!this.enableTimePicker);
          break;
      }
    },
    toggle: function toggle() {
      if (!this.tDisabled) {
        if (this.isOpen) {
          this.close();
        } else {
          this.open();
        }
      }
    },
    open: function open() {
      var _this = this;

      if (!this.tDisabled) {
        var formattedValue = this.formattedValue;

        if (formattedValue) {
          this.setDate(formattedValue);
        }

        this.tempValue = "";
        this.isOpen = true;
        this.$nextTick(function () {
          _this.$emit("open", _this.selectedDates);
        });
      }
    },
    close: function close() {
      if (!this.tDisabled) {
        this.tempValue = "";
        this.isOpen = false;
        this.showTime = false;
        this.$emit("close", this.selectedDates);
      }
    },
    clickedApply: function clickedApply() {
      var _this2 = this;

      var closePicker = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;

      if (this.range) {
        this.selectedDates = [this.start, this.end];
      }

      var selectedDates = this.selectedDates.map(function (d) {
        var fd = _this2.formatDate(d);

        return fd;
      });
      this.submitInput(selectedDates, true);
      this.$emit("onChange", selectedDates);

      if (closePicker) {
        this.close();
      }
    },
    toggleTime: function toggleTime() {
      var _this3 = this;

      this.startTimeValue = dayjs__default["default"](this.start);
      this.endTimeValue = dayjs__default["default"](this.end);
      this.showTime = !this.showTime;
      this.$nextTick(function () {
        var timePickerPanel = _this3.$refs.timePickerPanel;
        timePickerPanel && timePickerPanel.panelColUpdate();
      });
    },
    clickAway: function clickAway() {
      if (this.isOpen) {
        var selectedDates = this.selectedDates;

        if (selectedDates.length > 1) {
          this.start = new Date(selectedDates[0]);
          this.end = new Date(selectedDates[1]);
        }

        this.close();
      }
    },
    clickRange: function clickRange(value) {
      if (Array.isArray(value)) {
        var _value = _slicedToArray__default["default"](value, 2),
            start = _value[0],
            end = _value[1];

        this.start = dayjs__default["default"](start).toDate();
        this.end = dayjs__default["default"](end || start).toDate();
        this.monthDate = dayjs__default["default"](start).toDate();
      } else {
        this.start = dayjs__default["default"](value).toDate();
        this.end = dayjs__default["default"](value).toDate();
        this.monthDate = dayjs__default["default"](value).toDate();
      }

      this.clickedApply();
    },
    clear: function clear() {
      var triggerChange = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
      this.close();

      if (!this.tDisabled) {
        var selectedDates = [];
        this.selectedDates = selectedDates;
        this.formattedValue = "";
        this.start = new Date();
        this.end = new Date();
        this.submitInput(selectedDates, triggerChange);
      }
    },
    submitInput: function submitInput(selectedDates) {
      var triggerChange = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
      var multiSeparator = this.multiSeparator;
      var mode = this.range ? "range" : this.mode;

      switch (mode) {
        case "date":
        case "month":
        case "year":
          if (triggerChange) {
            this.$emit("input", selectedDates.join(multiSeparator));
            this.$emit("change", selectedDates.join(multiSeparator));
          }

          break;

        case "range":
          if (triggerChange) {
            this.$emit("input", selectedDates);
            this.$emit("change", selectedDates);
          }

          break;
      }
    },
    parseDate: function parseDate() {
      var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
      var format = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";

      if (value instanceof Date) {
        return new Date(value);
      }

      if (format) {
        var oDate = dayjs__default["default"](value, format);

        if (oDate.isValid()) {
          return new Date(oDate.toDate());
        }

        return false;
      }

      var d2 = dayjs__default["default"](value);

      if (d2.isValid()) {
        return new Date(d2.toDate());
      }

      return false;
    },
    isEnabled: function isEnabled(value) {
      var min = this.min,
          max = this.max,
          disableDate = this.disableDate,
          dateFormat = this.dateFormat;

      if (!disableDate) {
        return true;
      }

      var isEnabled = true;

      if (typeof disableDate === "function") {
        return !disableDate(value);
      }

      if (Array.isArray(disableDate)) {
        var isIncludes = false;
        var formatedDisabledDate = disableDate.map(function (item) {
          return dayjs__default["default"](item, dateFormat);
        });
        formatedDisabledDate.forEach(function (item) {
          if (item.isSame(dayjs__default["default"](value))) {
            isIncludes = true;
          }
        });
        return !isIncludes;
      }

      var from = disableDate.from,
          to = disableDate.to;

      if (from && to) {
        var compareMin = dayjs__default["default"](new Date(from));
        var compareMax = dayjs__default["default"](new Date(to));
        return !dayjs__default["default"](value).isBetween(compareMin, compareMax, this.mode, "[]");
      }

      if (max && min) {
        var _compareMin = dayjs__default["default"](new Date(min));

        var _compareMax = dayjs__default["default"](new Date(max));

        isEnabled = dayjs__default["default"](value).isBetween(_compareMin, _compareMax, this.mode, "[]");
      } else if (min) {
        var _compareMin2 = dayjs__default["default"](new Date(min));

        isEnabled = !dayjs__default["default"](value).isBefore(_compareMin2, this.mode);
      } else if (max) {
        var _compareMax2 = dayjs__default["default"](new Date(max));

        isEnabled = !dayjs__default["default"](value).isAfter(_compareMax2, this.mode);
      }

      return isEnabled;
    },
    setDate: function setDate() {
      var inputDate = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
      var triggerChange = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;

      if (inputDate !== 0 && !inputDate || inputDate instanceof Array && inputDate.length === 0) {
        return this.clear(triggerChange);
      }

      var selectedDates = this.getDates(inputDate);
      this.selectedDates = selectedDates;

      if (selectedDates.length > 0) {
        var _selectedDates = _slicedToArray__default["default"](selectedDates, 2),
            start = _selectedDates[0],
            end = _selectedDates[1];

        this.start = start;
        this.end = end || start;
      }
    },
    getDates: function getDates() {
      var _this4 = this;

      var inputDate = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";

      if (inputDate !== 0 && !inputDate || inputDate instanceof Array && inputDate.length === 0) {
        return [];
      }

      var format = this.dateFormat || "";
      var dates = [];

      if (inputDate instanceof Array) {
        dates = inputDate.map(function (d) {
          var d1 = _this4.parseDate(d, format);

          return d1;
        });
      } else if (inputDate instanceof Date || typeof inputDate === "number") {
        dates = [this.parseDate(inputDate, format)];
      } else if (typeof inputDate === "string") {
        var mode = this.range ? "range" : this.mode;

        switch (mode) {
          case "date":
          case "month":
          case "year":
            dates = [this.parseDate(inputDate, format)];
            break;

          case "range":
            dates = inputDate.split(this.global.rangeSeparator || "-").map(function (d) {
              var d1 = _this4.parseDate(d, format);

              return d1;
            });
            break;
        }
      }

      var selectedDates = dates.filter(function (d) {
        var isEnable = d instanceof Date && _this4.isEnabled(d);

        return isEnable;
      });
      selectedDates.sort(function (a, b) {
        return a.getTime() - b.getTime();
      });
      return selectedDates;
    },
    formatDate: function formatDate(date) {
      var format = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
      var dateFormat = format || this.dateFormat || this.global.format;
      var arrTime = ["H", "h", "m", "s"];
      var hasTime = arrTime.some(function (f) {
        return String(dateFormat).includes(f);
      });

      if (this.enableTimePicker && !hasTime) {
        dateFormat = [dateFormat, "HH:mm:ss"].join(" ");
      }

      var d1 = new Date(date);
      return dayjs__default["default"](d1).format(dateFormat);
    },
    getPlaceholderText: function getPlaceholderText() {
      var _this$global, _this$global$placehol;

      var placeholder = this.placeholder,
          mode = this.mode;
      var placeholderStr = placeholder || ((_this$global = this.global) === null || _this$global === void 0 ? void 0 : (_this$global$placehol = _this$global.placeholder) === null || _this$global$placehol === void 0 ? void 0 : _this$global$placehol[mode]);

      if (placeholder && Array.isArray(placeholder)) {
        placeholderStr = placeholder.join(this.global.rangeSeparator);
      }

      return placeholderStr;
    },
    onPopupVisibleChange: function onPopupVisibleChange(visible, context) {
      if (context.trigger === "document") {
        this.toggle();
      }
    }
  },
  render: function render() {
    var _this5 = this;

    var h = arguments[0];
    var popupProps = this.popupProps,
        tDisabled = this.tDisabled,
        clearable = this.clearable,
        allowInput = this.allowInput,
        size = this.size,
        inputProps = this.inputProps,
        enableTimePicker = this.enableTimePicker,
        mode = this.mode,
        range = this.range,
        presets = this.presets,
        firstDayOfWeek = this.firstDayOfWeek;
    var start = this.start,
        end = this.end,
        showTime = this.showTime,
        startTimeValue = this.startTimeValue,
        global = this.global,
        isOpen = this.isOpen,
        endTimeValue = this.endTimeValue;
    var panelProps = {
      value: range ? [start, end] : start,
      mode: mode,
      firstDayOfWeek: firstDayOfWeek === void 0 ? 1 : firstDayOfWeek,
      disableDate: function disableDate(d) {
        return !_this5.isEnabled(d);
      },
      onChange: this.dateClick,
      global: this.global
    };

    var onPick = function onPick(date, context) {
      _this5.$emit("pick", date, context);
    };

    var panelComponent = range ? h(datePicker_panel_dateRange["default"], {
      "props": _objectSpread({}, _objectSpread(_objectSpread({}, panelProps), {}, {
        onPick: onPick
      }))
    }) : h(datePicker_panel_date["default"], {
      "props": _objectSpread({}, _objectSpread({}, panelProps))
    });

    var popupContent = function popupContent() {
      return h("div", {
        "ref": "dropdownPopup",
        "class": _this5.pickerStyles
      }, [enableTimePicker && showTime && h("div", [h("t-time-picker-panel", {
        "ref": "timePickerPanel",
        "attrs": {
          "format": _common_js_datePicker_utils.extractTimeFormat(_this5.dateFormat) || "HH:mm:ss",
          "cols": [timePicker_interface.EPickerCols.hour, timePicker_interface.EPickerCols.minute, timePicker_interface.EPickerCols.second],
          "steps": [1, 1, 1],
          "value": !range ? [startTimeValue] : [startTimeValue, endTimeValue],
          "range": true,
          "isFooterDisplay": false
        },
        "on": {
          "time-pick": _this5.handleTimePick
        }
      })]), !showTime && panelComponent, (!!presets || enableTimePicker) && h("div", {
        "class": "".concat(config.prefix, "-date-picker__footer")
      }, [h("calendar-presets", {
        "attrs": {
          "presets": presets,
          "global": global
        },
        "props": _objectSpread({}, {
          onClick: range ? _this5.clickRange : _this5.dateClick
        })
      }), enableTimePicker && h("div", {
        "class": "".concat(name, "--apply")
      }, [enableTimePicker && h("t-button", {
        "attrs": {
          "theme": "primary",
          "variant": "text"
        },
        "on": {
          "click": _this5.toggleTime
        }
      }, [showTime ? global.selectDate : global.selectTime]), h("t-button", {
        "attrs": {
          "theme": "primary"
        },
        "on": {
          "click": _this5.clickedApply
        }
      }, [global.confirm])])])]);
    };

    var inputClassNames = ["".concat(config.prefix, "-form-controls"), _defineProperty__default["default"]({}, utils_classnames["default"].STATUS.active, this.isOpen)];
    var prefixIcon = utils_renderTnode.renderTNodeJSX(this, "prefixIcon");
    var suffixIconSlot = utils_renderTnode.renderTNodeJSX(this, "suffixIcon");

    var suffixIcon = function suffixIcon() {
      if (suffixIconSlot) {
        return suffixIconSlot;
      }

      if (enableTimePicker) {
        return h("time-icon");
      }

      return h("calendar-icon");
    };

    return h("div", {
      "class": this.classes
    }, [h("t-popup", helper.helper([{
      "ref": "popup",
      "class": "".concat(name, "__popup-reference"),
      "attrs": {
        "trigger": "click",
        "placement": "bottom-left",
        "disabled": tDisabled,
        "showArrow": false,
        "visible": isOpen,
        "popupProps": popupProps,
        "overlayClassName": name,
        "content": popupContent,
        "expandAnimation": true
      }
    }, {
      "on": {
        "visible-change": this.onPopupVisibleChange
      }
    }]), [h("div", {
      "class": inputClassNames,
      "on": {
        "click": this.toggle
      }
    }, [h("t-input", {
      "ref": "native",
      "attrs": {
        "disabled": tDisabled,
        "clearable": clearable,
        "placeholder": this.getPlaceholderText(),
        "allowInput": allowInput ? 1 : 0,
        "size": size,
        "inputProps": inputProps,
        "prefixIcon": prefixIcon,
        "suffixIcon": suffixIcon
      },
      "on": {
        "clear": function clear(context) {
          context.e.stopPropagation();

          _this5.clear(true);
        },
        "focus": this.handleTInputFocus
      },
      "props": _objectSpread({}, _objectSpread({}, this.inputListeners)),
      "model": {
        value: _this5.formattedValue,
        callback: function callback($$v) {
          _this5.formattedValue = $$v;
        }
      }
    })])])]);
  }
});

exports["default"] = _DatePicker;
//# sourceMappingURL=date-picker.js.map
