/**
 * tdesign v0.32.0
 * (c) 2021 tdesign
 * @license MIT
 */

'use strict';

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

var helper = require('../_chunks/dep-44e6bdf6.js');
var _typeof = require('@babel/runtime/helpers/typeof');
var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
var dayjs = require('dayjs');
var _commonjsHelpers = require('../_chunks/dep-939cdc39.js');
var calendar_props = require('./props.js');
var utils_mixins = require('../utils/mixins.js');
var configProvider_configReceiver = require('../config-provider/config-receiver.js');
var calendar_utils = require('./utils.js');
var utils_helper = require('../utils/helper.js');
var calendar_const = require('./const.js');
var select_index = require('../select/index.js');
var radio_index = require('../radio/index.js');
var button_index = require('../button/index.js');
var tag_index = require('../tag/index.js');
var calendar_calendarCell = require('./calendar-cell.js');
var utils_renderComponent = require('../utils/render-component.js');
var utils_renderTnode = require('../utils/render-tnode.js');
require('vue');
require('../config-provider/zh_CN_config.js');
require('@babel/runtime/helpers/objectWithoutProperties');
require('lodash/camelCase');
require('../config.js');
require('../select/select.js');
require('@babel/runtime/helpers/toConsumableArray');
require('lodash/isFunction');
require('lodash/debounce');
require('lodash/get');
require('lodash/set');
require('tdesign-icons-vue');
require('../loading/index.js');
require('../loading/loading.js');
require('../loading/icon/gradient.js');
require('../utils/set-style.js');
require('../utils/classnames.js');
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('../popup/index.js');
require('../popup/popup.js');
require('@popperjs/core');
require('../popup/props.js');
require('../utils/map-props.js');
require('../input/index.js');
require('../input/addon.js');
require('../input/input.js');
require('../utils/event.js');
require('../input/props.js');
require('../input/input-group.js');
require('../common-components/fake-arrow.js');
require('../select/option.js');
require('../utils/ripple.js');
require('../select/option-props.js');
require('../checkbox/index.js');
require('../checkbox/group.js');
require('lodash/intersection');
require('../checkbox/checkbox.js');
require('../checkbox/props.js');
require('../checkbox/checkbox-group-props.js');
require('../select/props.js');
require('../select/optionGroup.js');
require('../select/option-group-props.js');
require('../tag/tag.js');
require('../tag/props.js');
require('../tag/check-tag.js');
require('../tag/check-tag-props.js');
require('../radio/radio.js');
require('../radio/props.js');
require('../radio/group.js');
require('lodash/isNumber');
require('../radio/radio-group-props.js');
require('../radio/radio-button.js');
require('../button/button.js');
require('../button/props.js');

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

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

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

    return function (e, t, a) {
      var n = "h:mm A",
          d = {
        lastDay: "[Yesterday at] " + n,
        sameDay: "[Today at] " + n,
        nextDay: "[Tomorrow at] " + n,
        nextWeek: "dddd [at] " + n,
        lastWeek: "[Last] dddd [at] " + n,
        sameElse: "MM/DD/YYYY"
      };

      t.prototype.calendar = function (e, t) {
        var n = t || this.$locale().calendar || d,
            o = a(e || void 0).startOf("d"),
            s = this.diff(o, "d", !0),
            i = "sameElse",
            f = s < -6 ? i : s < -1 ? "lastWeek" : s < 0 ? "lastDay" : s < 1 ? "sameDay" : s < 2 ? "nextDay" : s < 7 ? "nextWeek" : i,
            l = n[f] || d[f];
        return "function" == typeof l ? l.call(this, a()) : this.format(l);
      };
    };
  });
});

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(calendar);

var createDefaultCurDate = function createDefaultCurDate() {
  return dayjs__default["default"](dayjs__default["default"]().format("YYYY-MM-DD"));
};

var getDefaultControllerConfigData = function getDefaultControllerConfigData() {
  var visible = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
  return {
    visible: visible,
    disabled: false,
    mode: {
      visible: true,
      radioGroupProps: {}
    },
    year: {
      visible: true,
      selecteProps: {}
    },
    month: {
      visible: true,
      selecteProps: {}
    },
    weekend: {
      visible: true,
      showWeekendButtonProps: {},
      hideWeekendButtonProps: {}
    },
    current: {
      visible: true,
      currentDayButtonProps: {},
      currentMonthButtonProps: {}
    }
  };
};

var _Calendar = utils_mixins["default"](configProvider_configReceiver["default"]("calendar")).extend({
  name: "TCalendar",
  components: {
    TCheckTag: tag_index.CheckTag,
    TSelect: select_index.Select,
    TOption: select_index.Option,
    TRadioGroup: radio_index.RadioGroup,
    TRadioButton: radio_index.RadioButton,
    TButton: button_index.Button,
    CalendarCellItem: calendar_calendarCell["default"],
    RenderComponent: utils_renderComponent["default"]
  },
  props: _objectSpread({}, calendar_props["default"]),
  data: function data() {
    return {
      curDate: null,
      curSelectedYear: null,
      curSelectedMonth: null,
      curSelectedMode: null,
      isShowWeekend: true,
      controlSize: "medium"
    };
  },
  computed: {
    realFirstDayOfWeek: function realFirstDayOfWeek() {
      var _ref, _this$firstDayOfWeek;

      return (_ref = (_this$firstDayOfWeek = this.firstDayOfWeek) !== null && _this$firstDayOfWeek !== void 0 ? _this$firstDayOfWeek : this.global.firstDayOfWeek) !== null && _ref !== void 0 ? _ref : 1;
    },
    TEXT_MAP: function TEXT_MAP() {
      var t = this.t,
          global = this.global;
      var r = {
        showWeekend: t(global.showWeekend),
        hideWeekend: t(global.hideWeekend),
        today: t(global.today),
        thisMonth: t(global.thisMonth)
      };
      return r;
    },
    weekDipalyText: function weekDipalyText() {
      return this.week || this.t(this.global.week).split(",");
    },
    calendarCls: function calendarCls() {
      return ["".concat(calendar_const.COMPONENT_NAME), "".concat(calendar_const.COMPONENT_NAME, "--").concat(this.theme)];
    },
    calendarPanelCls: function calendarPanelCls() {
      return ["".concat(calendar_const.COMPONENT_NAME, "__panel"), "".concat(calendar_const.COMPONENT_NAME, "__panel--").concat(this.curSelectedMode)];
    },
    isWeekRender: function isWeekRender() {
      return typeof this.week === "function";
    },
    rangeFromTo: function rangeFromTo() {
      if (!this.range || this.range.length < 2) {
        return null;
      }

      var _this$range = _slicedToArray__default["default"](this.range, 2),
          v1 = _this$range[0],
          v2 = _this$range[1];

      if (dayjs__default["default"](v1).isBefore(dayjs__default["default"](v2))) {
        return {
          from: v1,
          to: v2
        };
      }

      return {
        from: v2,
        to: v1
      };
    },
    controllerOptions: function controllerOptions() {
      var dayJsFilterDate = dayjs__default["default"]("".concat(this.curSelectedYear, "-").concat(this.curSelectedMonth));
      var re = {
        isShowWeekend: this.isShowWeekend,
        filterDate: dayJsFilterDate.toDate(),
        formattedFilterDate: dayJsFilterDate.format(this.format),
        mode: this.curSelectedMode
      };
      return re;
    },
    cellColHeaders: function cellColHeaders() {
      var re = [];
      var min = 1;
      var max = 7;

      for (var i = this.realFirstDayOfWeek; i <= max; i++) {
        re.push({
          num: i,
          display: this.getWeekDisplay(i)
        });
      }

      if (this.realFirstDayOfWeek > min) {
        for (var _i = min; _i < this.realFirstDayOfWeek; _i++) {
          re.push({
            num: _i,
            display: this.getWeekDisplay(_i)
          });
        }
      }

      return re;
    },
    yearSelectOptionList: function yearSelectOptionList() {
      var re = [];
      var begin = this.curSelectedYear - 10;
      var end = this.curSelectedYear + 10;

      if (this.rangeFromTo && this.rangeFromTo.from && this.rangeFromTo.to) {
        begin = dayjs__default["default"](this.rangeFromTo.from).year();
        end = dayjs__default["default"](this.rangeFromTo.to).year();
      }

      if (begin < calendar_const.MIN_YEAR) {
        begin = calendar_const.MIN_YEAR;
      }

      if (end < calendar_const.MIN_YEAR) {
        end = calendar_const.MIN_YEAR;
      }

      for (var i = begin; i <= end; i++) {
        var disabled = this.checkMonthAndYearSelecterDisabled(i, this.curSelectedMonth);
        re.push({
          value: i,
          label: this.t(this.global.yearSelection, {
            year: i
          }),
          disabled: disabled
        });
      }

      return re;
    },
    monthSelectOptionList: function monthSelectOptionList() {
      var re = [];

      for (var i = calendar_const.FIRST_MONTH_OF_YEAR; i <= calendar_const.LAST_MONTH_OF_YEAR; i++) {
        var disabled = this.checkMonthAndYearSelecterDisabled(this.curSelectedYear, i);
        re.push({
          value: i,
          label: this.t(this.global.monthSelection, {
            month: i
          }),
          disabled: disabled
        });
      }

      return re;
    },
    modeSelectOptionList: function modeSelectOptionList() {
      return [{
        value: "month",
        label: this.t(this.global.monthRadio)
      }, {
        value: "year",
        label: this.t(this.global.yearRadio)
      }];
    },
    monthCellsData: function monthCellsData() {
      var realFirstDayOfWeek = this.realFirstDayOfWeek;
      var daysArr = calendar_utils.createMonthCellsData(this.curSelectedYear, this.curSelectedMonth, realFirstDayOfWeek, this.curDate, this.format);
      return daysArr;
    },
    yearCellsData: function yearCellsData() {
      var re = [];
      var monthsArr = calendar_utils.createYearCellsData(this.curSelectedYear, this.curDate, this.format);
      var rowCount = Math.ceil(monthsArr.length / calendar_const.DEFAULT_YEAR_CELL_NUMINROW);
      var index = 0;

      for (var i = 1; i <= rowCount; i++) {
        var row = [];

        for (var j = 1; j <= calendar_const.DEFAULT_YEAR_CELL_NUMINROW; j++) {
          row.push(monthsArr[index]);
          index += 1;
        }

        re.push(row);
      }

      return re;
    },
    controllerConfigData: function controllerConfigData() {
      if (typeof this.controllerConfig === "boolean") {
        return getDefaultControllerConfigData(this.controllerConfig);
      }

      return _objectSpread(_objectSpread({}, getDefaultControllerConfigData()), this.controllerConfig);
    },
    isControllerVisible: function isControllerVisible() {
      return this.controllerConfigData && this.controllerConfigData.visible;
    },
    weekendBtnText: function weekendBtnText() {
      return this.isShowWeekend ? this.TEXT_MAP.hideWeekend : this.TEXT_MAP.showWeekend;
    },
    weekendBtnVBind: function weekendBtnVBind() {
      var c = this.controllerConfigData.weekend;
      return this.isShowWeekend ? c.hideWeekendButtonProps : c.showWeekendButtonProps;
    },
    currentBtnText: function currentBtnText() {
      return this.curSelectedMode === "month" ? this.TEXT_MAP.today : this.TEXT_MAP.thisMonth;
    },
    currentBtnVBind: function currentBtnVBind() {
      var c = this.controllerConfigData.current;
      return this.curSelectedMode === "month" ? c.currentDayButtonProps : c.currentMonthButtonProps;
    },
    isModeVisible: function isModeVisible() {
      return this.checkControllerVisible("mode");
    },
    isYearVisible: function isYearVisible() {
      return this.checkControllerVisible("year");
    },
    isMonthVisible: function isMonthVisible() {
      return this.checkControllerVisible("month");
    },
    isWeekendToggleVisible: function isWeekendToggleVisible() {
      return this.checkControllerVisible("weekend");
    },
    isCurrentBtnVisible: function isCurrentBtnVisible() {
      return this.checkControllerVisible("current");
    },
    isModeDisabled: function isModeDisabled() {
      return this.checkControllerDisabled("mode", "radioGroupProps");
    },
    isYearDisabled: function isYearDisabled() {
      return this.checkControllerDisabled("year", "selecteProps");
    },
    isMonthDisabled: function isMonthDisabled() {
      return this.checkControllerDisabled("month", "selecteProps");
    },
    isWeekendToggleDisabled: function isWeekendToggleDisabled() {
      var p = this.isShowWeekend ? "hideWeekendButtonProps" : "showWeekendButtonProps";
      return this.checkControllerDisabled("weekend", p);
    },
    isCurrentBtnDisabled: function isCurrentBtnDisabled() {
      var p = this.curSelectedMode === "month" ? "currentDayButtonProps" : "currentMonthButtonProps";
      return this.checkControllerDisabled("current", p);
    }
  },
  watch: {
    value: {
      handler: function handler(v) {
        this.toCurrent(v);
      },
      immediate: true
    },
    mode: {
      handler: function handler(v) {
        this.curSelectedMode = v;
      },
      immediate: true
    },
    isShowWeekendDefault: {
      handler: function handler(v) {
        this.isShowWeekend = v;
      },
      immediate: true
    }
  },
  methods: {
    getCalendarWeekSlotData: function getCalendarWeekSlotData(item) {
      return {
        day: item.num
      };
    },
    getWeekDisplay: function getWeekDisplay(weekNum) {
      var weekText = this.weekDipalyText;
      return _typeof__default["default"](weekText) === "object" && weekText[weekNum - 1] ? weekText[weekNum - 1] : calendar_utils.getDayCn(weekNum);
    },
    checkMonthCellItemShowed: function checkMonthCellItemShowed(cellData) {
      return this.isShowWeekend || cellData.day < 6;
    },
    createCalendarCell: function createCalendarCell(cellData) {
      return _objectSpread(_objectSpread({}, cellData), this.controllerOptions);
    },
    clickCell: function clickCell(e, cellData) {
      this.curDate = dayjs__default["default"](cellData.date);
      this.execCellEvent(e, cellData, "cell-click");
    },
    doubleClickCell: function doubleClickCell(e, cellData) {
      this.execCellEvent(e, cellData, "cell-double-click");
    },
    rightClickCell: function rightClickCell(e, cellData) {
      if (this.preventCellContextmenu) {
        e.preventDefault();
      }

      this.execCellEvent(e, cellData, "cell-right-click");
    },
    execCellEvent: function execCellEvent(e, cellData, emitName) {
      var options = {
        cell: this.createCalendarCell(cellData),
        e: e
      };
      var cellEvent = this[utils_helper.getPropsApiByEvent(emitName)];

      if (typeof cellEvent === "function") {
        cellEvent(options);
      }

      this.$emit(emitName, options);
    },
    controllerChange: function controllerChange() {
      var options = this.controllerOptions;

      if (typeof this.onControllerChange === "function") {
        this.onControllerChange(options);
      }

      this.$emit("controller-change", options);
    },
    onWeekendToggleClick: function onWeekendToggleClick() {
      this.isShowWeekend = !this.isShowWeekend;
      this.controllerChange();
    },
    checkMonthCellColHeaderVisibled: function checkMonthCellColHeaderVisibled(item) {
      var re = true;

      if (!this.isShowWeekend) {
        re = item.num !== 6 && item.num !== 7;
      }

      return re;
    },
    checkControllerDisabled: function checkControllerDisabled(name, propsName) {
      var re = false;
      var conf = this.controllerConfigData;

      if (conf && (conf.disabled || conf[name] && conf[name][propsName] && conf[name][propsName].disabled)) {
        re = true;
      }

      return re;
    },
    checkControllerVisible: function checkControllerVisible(name) {
      var re = true;
      var conf = this.controllerConfigData;

      if (!conf || !conf.visible || conf[name] === false || conf[name] && !conf[name].visible) {
        re = false;
      }

      return re;
    },
    toCurrent: function toCurrent(value) {
      this.curDate = value ? dayjs__default["default"](value) : createDefaultCurDate();
      this.curSelectedYear = this.curDate.year();
      this.curSelectedMonth = parseInt(this.curDate.format("M"), 10);
    },
    checkMonthAndYearSelecterDisabled: function checkMonthAndYearSelecterDisabled(year, month) {
      var disabled = false;

      if (this.rangeFromTo && this.rangeFromTo.from && this.rangeFromTo.to) {
        var beginYear = dayjs__default["default"](this.rangeFromTo.from).year();
        var endYear = dayjs__default["default"](this.rangeFromTo.to).year();

        if (year === beginYear) {
          var beginMon = parseInt(dayjs__default["default"](this.rangeFromTo.from).format("M"), 10);
          disabled = month < beginMon;
        } else if (year === endYear) {
          var endMon = parseInt(dayjs__default["default"](this.rangeFromTo.to).format("M"), 10);
          disabled = month > endMon;
        }
      }

      return disabled;
    },
    renderControl: function renderControl() {
      var _this = this;

      var h = this.$createElement;
      var controllerOptions = this.controllerOptions;
      return h("div", {
        "class": "".concat(calendar_const.COMPONENT_NAME, "__control")
      }, [h("div", {
        "class": "".concat(calendar_const.COMPONENT_NAME, "__title")
      }, [utils_renderTnode.renderTNodeJSX(this, "head", {
        params: controllerOptions
      })]), h("div", {
        "class": "".concat(calendar_const.COMPONENT_NAME, "__control-section")
      }, [this.isYearVisible && h("div", {
        "class": "".concat(calendar_const.COMPONENT_NAME, "__control-section-cell")
      }, [h("t-select", helper.helper([{
        "attrs": {
          "size": this.controlSize,
          "disabled": this.isYearDisabled
        }
      }, this.controllerConfigData.year.selecteProps, {
        "on": {
          "change": this.controllerChange
        },
        "model": {
          value: _this.curSelectedYear,
          callback: function callback($$v) {
            _this.curSelectedYear = $$v;
          }
        }
      }]), [this.yearSelectOptionList.map(function (item) {
        return h("t-option", {
          "key": item.value,
          "attrs": {
            "value": item.value,
            "label": item.label,
            "disabled": item.disabled
          }
        }, [item.label]);
      })])]), this.curSelectedMode === "month" && this.isMonthVisible && h("div", {
        "class": "".concat(calendar_const.COMPONENT_NAME, "__control-section-cell")
      }, [h("t-select", helper.helper([{
        "attrs": {
          "size": this.controlSize,
          "disabled": this.isMonthDisabled
        }
      }, this.controllerConfigData.year.selecteProps, {
        "on": {
          "change": this.controllerChange
        },
        "model": {
          value: _this.curSelectedMonth,
          callback: function callback($$v) {
            _this.curSelectedMonth = $$v;
          }
        }
      }]), [this.monthSelectOptionList.map(function (item) {
        return h("t-option", {
          "key": item.value,
          "attrs": {
            "value": item.value,
            "label": item.label,
            "disabled": item.disabled
          }
        }, [item.label]);
      })])]), this.isModeVisible && h("div", {
        "class": "".concat(calendar_const.COMPONENT_NAME, "__control-section-cell"),
        "style": "height: auto"
      }, [h("t-radio-group", helper.helper([{
        "attrs": {
          "variant": "default-filled",
          "size": this.controlSize,
          "disabled": this.isModeDisabled
        }
      }, this.controllerConfigData.mode.radioGroupProps, {
        "on": {
          "change": this.controllerChange
        },
        "model": {
          value: _this.curSelectedMode,
          callback: function callback($$v) {
            _this.curSelectedMode = $$v;
          }
        }
      }]), [this.modeSelectOptionList.map(function (item) {
        return h("t-radio-button", {
          "key": item.value,
          "attrs": {
            "value": item.value
          }
        }, [item.label]);
      })])]), this.theme === "full" && this.curSelectedMode && this.isWeekendToggleVisible && h("div", {
        "class": "".concat(calendar_const.COMPONENT_NAME, "__control-section-cell")
      }, [h("t-check-tag", helper.helper([{
        "class": "".concat(calendar_const.COMPONENT_NAME, "__control-tag"),
        "attrs": {
          "theme": this.isShowWeekend ? "default" : "primary",
          "size": this.controlSize,
          "disabled": this.isWeekendToggleDisabled
        }
      }, this.weekendBtnVBind, {
        "on": {
          "click": this.onWeekendToggleClick
        }
      }]), [this.weekendBtnText])]), this.theme === "full" && this.isCurrentBtnVisible && h("div", {
        "class": "".concat(calendar_const.COMPONENT_NAME, "__control-section-cell")
      }, [h("t-button", helper.helper([{
        "attrs": {
          "size": this.controlSize,
          "disabled": this.isCurrentBtnDisabled
        },
        "on": {
          "click": function click() {
            _this.toCurrent();
          }
        }
      }, this.currentBtnVBind]), [this.currentBtnText])])])]);
    }
  },
  render: function render() {
    var _this2 = this;

    var h = arguments[0];
    var calendarCls = this.calendarCls,
        calendarPanelCls = this.calendarPanelCls,
        isControllerVisible = this.isControllerVisible,
        cellColHeaders = this.cellColHeaders,
        checkMonthCellColHeaderVisibled = this.checkMonthCellColHeaderVisibled;

    var monthBody = function monthBody() {
      return h("table", {
        "class": "".concat(calendar_const.COMPONENT_NAME, "__table")
      }, [h("thead", {
        "class": "".concat(calendar_const.COMPONENT_NAME, "__table-head")
      }, [h("tr", {
        "class": "".concat(calendar_const.COMPONENT_NAME, "__table-head-row")
      }, [cellColHeaders.map(function (item, index) {
        return checkMonthCellColHeaderVisibled(item) && h("th", {
          "class": "".concat(calendar_const.COMPONENT_NAME, "__table-head-cell")
        }, [Array.isArray(_this2.week) ? _this2.week[index] : utils_renderTnode.renderTNodeJSXDefault(_this2, "week", {
          defaultNode: h("span", [item.display]),
          params: _this2.getCalendarWeekSlotData(item)
        })]);
      })])]), h("tbody", {
        "class": "".concat(calendar_const.COMPONENT_NAME, "__table-body")
      }, [_this2.monthCellsData.map(function (week, weekIndex) {
        return h("tr", {
          "class": "".concat(calendar_const.COMPONENT_NAME, "__table-body-row")
        }, [week.map(function (item, itemIndex) {
          return _this2.checkMonthCellItemShowed(item) && h("calendar-cell-item", {
            "key": "".concat(weekIndex, "-").concat(itemIndex),
            "attrs": {
              "item": item,
              "theme": _this2.theme,
              "t": _this2.t,
              "global": _this2.global,
              "cell": _this2.cell,
              "fillWithZero": _this2.fillWithZero
            },
            "on": {
              "click": function click(e) {
                return _this2.clickCell(e, item);
              },
              "dblclick": function dblclick(e) {
                return _this2.doubleClickCell(e, item);
              },
              "rightClickCell": function rightClickCell(e) {
                return _this2.rightClickCell(e, item);
              }
            },
            "scopedSlots": _objectSpread({}, _this2.$scopedSlots)
          });
        })]);
      })])]);
    };

    var yearBody = function yearBody() {
      return h("table", {
        "class": "".concat(calendar_const.COMPONENT_NAME, "__table")
      }, [h("tbody", {
        "class": "".concat(calendar_const.COMPONENT_NAME, "__table-body")
      }, [_this2.yearCellsData.map(function (cell, cellIndex) {
        return h("tr", {
          "class": "".concat(calendar_const.COMPONENT_NAME, "__table-body-row")
        }, [cell.map(function (item, itemIndex) {
          return _this2.checkMonthCellItemShowed(item) && h("calendar-cell-item", {
            "key": "".concat(cellIndex, "-").concat(itemIndex),
            "attrs": {
              "item": item,
              "theme": _this2.theme,
              "t": _this2.t,
              "global": _this2.global,
              "cell": _this2.cell,
              "fillWithZero": _this2.fillWithZero
            },
            "on": {
              "click": function click(e) {
                return _this2.clickCell(e, item);
              },
              "dblclick": function dblclick(e) {
                return _this2.doubleClickCell(e, item);
              },
              "rightClickCell": function rightClickCell(e) {
                return _this2.rightClickCell(e, item);
              }
            },
            "scopedSlots": _objectSpread({}, _this2.$scopedSlots)
          });
        })]);
      })])]);
    };

    return h("div", {
      "class": calendarCls
    }, [isControllerVisible && this.renderControl(), h("div", {
      "class": calendarPanelCls
    }, [this.curSelectedMode === "month" ? monthBody() : yearBody()])]);
  }
});

exports["default"] = _Calendar;
//# sourceMappingURL=calendar.js.map
