/**
 * ldesign v0.2.14
 * (c) 2022/11/2 16:16 built by swimly
 * @license MIT
 */

import { defineComponent, computed } from '@vue/composition-api';
import { g as getDefaultFormat, p as parseToDayjs } from '../../../chunks/format.js';
import { usePrefixClass } from '../../../hooks/use-config.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/dayjs.min-c4f4ce86.js';
import '../../../chunks/_commonjsHelpers-2e6815bd.js';
import '../../../chunks/log.js';
import '../../../chunks/utils.js';
import '../../../chunks/defineProperty-838e4192.js';
import '../../../chunks/_isIndex-52887d1e.js';
import '../../../chunks/isFunction-91acade7.js';
import '../../../chunks/isObjectLike-c22c7e3b.js';
import '../../../chunks/isSymbol-a38a5184.js';
import '../../config-provider/context.js';
import 'lodash';
import '../../../chunks/zh_CN.js';
import '../../config-provider/type.js';
import 'dayjs';
import '../../../chunks/_commonjsHelpers.js';
import 'lodash/isObject';
import '../base/Footer.js';
import '../../button/index.js';
import '../../../utils/with-install.js';
import 'vue';
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 '../../../chunks/index.js';
import '../../../utils/easing.js';
import '../../../utils/render-node.js';
import '../../../utils/transfer-dom.js';
import '../../config-provider/config-receiver.js';
import 'lodash/mergeWith';
import '../../../utils/mixins.js';
import '../../loading/props.js';
import '../../loading/icon/gradient.js';
import '../../../chunks/set-style.js';
import '../../../chunks/helper2.js';
import '../../loading/style';
import '../../loading/type.js';
import '../../loading/plugin.js';
import '../../../utils/ripple.js';
import '../../button/props.js';
import '../../button/style';
import '../../button/type.js';
import '../../../chunks/helper.js';
import '../base/Header.js';
import '../../jumper/jumper.js';
import '../../../hooks/use-global-icon.js';
import '../../jumper/props.js';
import '../../select/select.js';
import 'lodash/isFunction';
import 'lodash/debounce';
import 'lodash/get';
import 'lodash/cloneDeep';
import 'lodash/isArray';
import '../../../hooks/use-default-value.js';
import '../../../hooks/use-vmodel.js';
import 'lodash/kebabCase';
import '../../../hooks/lnode.js';
import 'lodash/isEmpty';
import 'lodash/camelCase';
import '../../../hooks/render-lnode.js';
import '../../popup/index.js';
import '../../../utils/map-props.js';
import '../../popup/popup.js';
import '@popperjs/core';
import '../../../utils/helper.js';
import '../../popup/props.js';
import '../../popup/container.js';
import '../../popup/style';
import '../../popup/type.js';
import '../../input/index.js';
import '../../input/input.js';
import '../../../utils/event.js';
import '../../input/props.js';
import '../../input/group.js';
import '../../input/style';
import '../../input/type.js';
import '../../tag/index.js';
import '../../tag/tag.js';
import '../../tag/props.js';
import '../../tag/check-tag.js';
import '../../tag/style';
import '../../tag/type.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 '../../tag-input/style';
import '../../tag-input/type.js';
import '../../select-input/hooks/use-overlay-innerstyle.js';
import '../../select-input/style';
import '../../select-input/type.js';
import '../../common/fake-arrow.js';
import '../../../hooks/use-form-disabled.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 '../../checkbox/style';
import '../../checkbox/type.js';
import '../../../hooks/use-lazy-load.js';
import '../../../chunks/observe.js';
import '../../../hooks/use-common-classname.js';
import '../../select/utils.js';
import '../../select/props.js';
import '../../select/select-panel.js';
import '../../../hooks/use-virtual-scroll.js';
import '../../select/hooks/use-select-options.js';
import '../base/Table.js';
import '../base/Cell.js';
import '../../time-picker/panel/time-picker-panel.js';
import '../../../chunks/single-panel.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 = 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
    }));
    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 => {
          var _this$onPanelClick;
          return (_this$onPanelClick = this.onPanelClick) === null || _this$onPanelClick === void 0 ? void 0 : _this$onPanelClick.call(this, {
            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
