/**
 * ldesign v0.2.22
 * (c) 2022/12/7 16:21 built by swimly
 * @license MIT
 */

import { defineComponent, computed } from '@vue/composition-api';
import { g as getDefaultFormat, p as parseToDayjs } from '../../../_chunks/dep-45f37c99.js';
import { usePrefixClass } from '../../../hooks/useConfig.js';
import useTableData from '../hooks/use-table-data.js';
import useDisableDate from '../hooks/use-disabled-date.js';
import TExtraContent from './extra-content.js';
import TPanelContent from './panel-content.js';
import { useConfig } from '../../config-provider/useConfig.js';
import '../../../_chunks/dep-72951546.js';
import '../../../_chunks/dep-102361be.js';
import '../../../_chunks/dep-eaa95999.js';
import '../../../_chunks/dep-52f1cb4f.js';
import '../../../_chunks/dep-aacc31a3.js';
import '../../../_chunks/dep-40693b6f.js';
import '../../../_chunks/dep-c3acb800.js';
import '../../../_chunks/dep-52c80d08.js';
import '../../../_chunks/dep-128cad98.js';
import '../../config-provider/context.js';
import 'lodash/merge';
import 'lodash/mergeWith';
import '../../../_chunks/dep-b4fd1955.js';
import 'dayjs';
import '../../../_chunks/dep-c7f511ef.js';
import 'lodash/isObject';
import '../base/Footer.js';
import '../../button/index.js';
import '../../../utils/withInstall.js';
import 'vue';
import 'lodash/capitalize';
import '../../../config.js';
import '../../button/button.js';
import '@ldesign/icons-vue';
import '../../loading/index.js';
import '../../loading/loading.js';
import '../../../utils/dom.js';
import 'raf';
import 'lodash/isString';
import '../../../utils/easing.js';
import '../../../utils/render-node.js';
import 'lodash';
import '../../../utils/transfer-dom.js';
import '../../config-provider/config-receiver.js';
import '../../../utils/mixins.js';
import '../../loading/props.js';
import '../../loading/icon/gradient.js';
import '../../../_chunks/dep-c68dc4b6.js';
import '../../../_chunks/dep-1a6bca30.js';
import '../../loading/plugin.js';
import '../../../utils/ripple.js';
import '../../button/props.js';
import '../../../_chunks/dep-b0f1ed22.js';
import '../base/Header.js';
import '../../pagination/index.js';
import '../../../utils/map-props.js';
import '../../pagination/pagination-mini.js';
import '../../../hooks/useGlobalIcon.js';
import '../../pagination/props.js';
import '../../pagination/pagination.js';
import '../../input-number/index.js';
import '../../input-number/input-number.js';
import '../../input/index.js';
import '../../input/input.js';
import 'lodash/camelCase';
import 'lodash/kebabCase';
import '../../../utils/helper.js';
import '../../../utils/event.js';
import '../../input/props.js';
import '../../input/group.js';
import '../../input-number/props.js';
import '../../input-number/hooks/use-input-number.js';
import '../../../_chunks/dep-25603871.js';
import '../../../_chunks/dep-7b293b33.js';
import '../../../hooks/useCommonClassName.js';
import '../../../hooks/useVModel.js';
import '../../../hooks/useFormDisabled.js';
import '../../select/index.js';
import '../../select/select.js';
import 'lodash/isFunction';
import 'lodash/debounce';
import 'lodash/get';
import 'lodash/cloneDeep';
import 'lodash/isArray';
import '../../../hooks/useDefaultValue.js';
import '../../../hooks/lnode.js';
import 'lodash/isEmpty';
import '../../../hooks/render-lnode.js';
import '../../popup/index.js';
import '../../popup/popup.js';
import '@popperjs/core';
import '../../popup/props.js';
import '../../popup/container.js';
import '../../tag/index.js';
import '../../tag/tag.js';
import '../../tag/props.js';
import '../../tag/check-tag.js';
import '../../select-input/index.js';
import '../../select-input/select-input.js';
import '../../select-input/props.js';
import '../../select-input/hooks/use-single.js';
import 'lodash/pick';
import '../../select-input/hooks/use-multiple.js';
import '../../tag-input/index.js';
import '../../tag-input/tag-input.js';
import '../../tag-input/props.js';
import '../../tag-input/hooks/use-tag-scroll.js';
import '../../tag-input/hooks/use-tag-list.js';
import '../../tag-input/hooks/use-hover.js';
import '../../tag-input/hooks/use-drag-sorter.js';
import '../../select-input/hooks/use-overlay-innerstyle.js';
import '../../common/fake-arrow.js';
import '../../select/option.js';
import '../../checkbox/index.js';
import '../../checkbox/group.js';
import 'lodash/intersection';
import '../../checkbox/checkbox.js';
import '../../checkbox/props.js';
import '../../../hooks/useLazyLoad.js';
import '../../../_chunks/dep-62ed000f.js';
import '../../select/utils.js';
import '../../select/props.js';
import '../../select/select-panel.js';
import '../../../hooks/useVirtualScroll.js';
import '../../select/hooks/use-select-options.js';
import '../../select/option-group.js';
import '../../input-adornment/index.js';
import '../../input-adornment/input-adornment.js';
import '../../input-adornment/props.js';
import '../base/Table.js';
import '../base/Cell.js';
import '../../time-picker/panel/time-picker-panel.js';
import '../../../_chunks/dep-bdaccf99.js';
import 'lodash/range';
import 'lodash/padStart';
import '../../time-picker/panel/props.js';
import '../../time-picker/props.js';

var TSinglePanel = defineComponent({
  name: "LSinglePanel",
  props: {
    disableDate: [Object, Array, Function],
    mode: {
      type: String,
      default: "date"
    },
    format: String,
    presetsPlacement: {
      type: String,
      default: "bottom"
    },
    value: [String, Number, Array, Date],
    timePickerProps: Object,
    presets: Object,
    enableTimePicker: Boolean,
    firstDayOfWeek: Number,
    year: Number,
    month: Number,
    time: String,
    popupVisible: Boolean,
    onPanelClick: Function,
    onCellClick: Function,
    onCellMouseEnter: Function,
    onCellMouseLeave: Function,
    onJumperClick: Function,
    onConfirmClick: Function,
    onPresetClick: Function,
    onYearChange: Function,
    onMonthChange: Function,
    onTimePickerChange: Function
  },
  setup(props) {
    const COMPONENT_NAME = usePrefixClass("date-picker__panel");
    const {
      global
    } = useConfig("datePicker");
    const {
      format
    } = getDefaultFormat({
      mode: props.mode,
      format: props.format,
      enableTimePicker: props.enableTimePicker
    });
    const disableDateOptions = computed(() => useDisableDate({
      format,
      mode: props.mode,
      disableDate: props.disableDate
    }));
    const tableData = computed(() => useTableData({
      year: props.year,
      month: props.month,
      mode: props.mode,
      start: props.value ? parseToDayjs(props.value, format).toDate() : void 0,
      firstDayOfWeek: props.firstDayOfWeek || global.value.firstDayOfWeek,
      ...disableDateOptions.value
    }));
    const panelContentProps = computed(() => ({
      format,
      value: props.value,
      mode: props.mode,
      year: props.year,
      month: props.month,
      firstDayOfWeek: props.firstDayOfWeek || global.value.firstDayOfWeek,
      tableData: tableData.value,
      popupVisible: props.popupVisible,
      enableTimePicker: props.enableTimePicker,
      timePickerProps: props.timePickerProps,
      time: props.time,
      onMonthChange: props.onMonthChange,
      onYearChange: props.onYearChange,
      onJumperClick: props.onJumperClick,
      onCellClick: props.onCellClick,
      onCellMouseEnter: props.onCellMouseEnter,
      onCellMouseLeave: props.onCellMouseLeave,
      onTimePickerChange: props.onTimePickerChange
    }));
    const extraProps = computed(() => ({
      presets: props.presets,
      enableTimePicker: props.enableTimePicker,
      presetsPlacement: props.presetsPlacement,
      onPresetClick: props.onPresetClick,
      onConfirmClick: props.onConfirmClick,
      selectedValue: props.value
    }));
    return {
      COMPONENT_NAME,
      panelContentProps,
      extraProps
    };
  },
  render() {
    const h = arguments[0];
    const {
      COMPONENT_NAME,
      panelContentProps,
      extraProps
    } = this;
    return h("div", {
      "class": [COMPONENT_NAME, {
        [`${COMPONENT_NAME}--direction-row`]: ["left", "right"].includes(this.presetsPlacement)
      }],
      "on": {
        "click": e => this.onPanelClick?.({
          e
        })
      }
    }, [["top", "left"].includes(this.presetsPlacement) ? h(TExtraContent, {
      "props": {
        ...extraProps
      }
    }) : null, h(TPanelContent, {
      "props": {
        ...panelContentProps
      }
    }), ["bottom", "right"].includes(this.presetsPlacement) ? h(TExtraContent, {
      "props": {
        ...extraProps
      }
    }) : null]);
  }
});

export { TSinglePanel as default };
//# sourceMappingURL=single-panel.js.map
