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

import '../../hooks/useConfig.js';
import { getWeeks, getQuarters, getMonths, getYears, flagActive } from '../../_common/js/date-picker/utils.js';
import { useConfig } from '../../config-provider/useConfig.js';
import '@vue/composition-api';
import '../../config-provider/context.js';
import 'lodash/merge';
import 'lodash/mergeWith';
import '../../_common/js/global-config/default-config.js';
import '../../_common/js/global-config/locale/zh_CN.js';
import '../../config-provider/type.js';
import '@babel/runtime/helpers/slicedToArray';
import '@babel/runtime/helpers/extends';
import '@babel/runtime/helpers/defineProperty';
import 'dayjs';
import '../../_chunks/dep-a0d91f92.js';
import '../../_chunks/dep-b98966c0.js';
import 'lodash/chunk';

function useTableData(props) {
  var _props$firstDayOfWeek;

  var _useConfig = useConfig("datePicker"),
      global = _useConfig.global;

  var options = {
    minDate: props.minDate,
    maxDate: props.maxDate,
    disableDate: props.disableDate,
    firstDayOfWeek: (_props$firstDayOfWeek = props.firstDayOfWeek) !== null && _props$firstDayOfWeek !== void 0 ? _props$firstDayOfWeek : global.value.firstDayOfWeek,
    monthLocal: global.value.months,
    quarterLocal: global.value.quarters,
    showWeekOfYear: props.mode === "week"
  };
  var data = [];

  if (props.mode === "date") {
    data = getWeeks({
      year: props.year,
      month: props.month
    }, options);
  } else if (props.mode === "week") {
    data = getWeeks({
      year: props.year,
      month: props.month
    }, options);
  } else if (props.mode === "quarter") {
    data = getQuarters(props.year, options);
  } else if (props.mode === "month") {
    data = getMonths(props.year, options);
  } else if (props.mode === "year") {
    data = getYears(props.year, options);
  }

  return flagActive(data, {
    start: props.start,
    end: props.end,
    hoverStart: props.hoverStart,
    hoverEnd: props.hoverEnd,
    type: props.mode,
    isRange: props.isRange
  });
}

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