/**
 * tdesign v0.41.7
 * (c) 2022 tdesign
 * @license MIT
 */

import _defineProperty from '@babel/runtime/helpers/defineProperty';
import { prefix } from '../../config.js';
import TDatePickerCell from './cell.js';
import mixins from '../../utils/mixins.js';
import getConfigReceiverMixins from '../../config-provider/config-receiver.js';
import 'vue';
import 'lodash/mergeWith';
import '../../config-provider/context.js';
import 'lodash/merge';
import '../../_common/js/global-config/default-config.js';
import '../../_common/js/global-config/locale/zh_CN.js';
import '../../config-provider/type.js';

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(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; }
var name = "".concat(prefix, "-date-picker-table");
var DAY_NAMES = ["\u4E00", "\u4E8C", "\u4E09", "\u56DB", "\u4E94", "\u516D", "\u65E5"];
var TDateTable = mixins(getConfigReceiverMixins("datePicker")).extend({
  name: name,
  components: {
    TDatePickerCell: TDatePickerCell
  },
  props: {
    type: {
      type: String,
      "default": "day"
    },
    data: Array,
    firstDayOfWeek: Number,
    dayNames: {
      type: Array,
      "default": function _default() {
        return DAY_NAMES;
      }
    },
    onCellClick: {
      type: Function
    },
    onCellMouseEnter: {
      type: Function
    }
  },
  render: function render() {
    var h = arguments[0];
    var type = this.type,
        data = this.data,
        onCellClick = this.onCellClick,
        onCellMouseEnter = this.onCellMouseEnter,
        firstDayOfWeek = this.firstDayOfWeek;
    var weekdays = this.global.weekdays;
    var weekArr = [];
    var wi = firstDayOfWeek - 1;
    var len = weekdays.length;

    while (weekArr.length < len) {
      weekArr.push(weekdays[wi]);
      wi = (wi + len + 1) % len;
    }

    var panelClass = "".concat(prefix, "-date-picker--").concat(type);
    return h("div", {
      "class": panelClass
    }, [h("table", [type === "date" && h("thead", [h("tr", [weekArr.map(function (value, i) {
      return h("th", {
        "key": i
      }, [value]);
    })])]), h("tbody", [data.map(function (row, i) {
      return h("tr", {
        "key": i
      }, [row.map(function (col, j) {
        return h("t-date-picker-cell", {
          "props": _objectSpread({}, _objectSpread(_objectSpread({}, col), {}, {
            onClick: onCellClick,
            onMouseEnter: onCellMouseEnter
          })),
          "key": j
        });
      })]);
    })])])]);
  }
});

export { TDateTable as default };
//# sourceMappingURL=table.js.map
