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

'use strict';

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

var VueCompositionAPI = require('@vue/composition-api');
var format = require('../../../chunks/format.js');
var hooks_useConfig = require('../../../hooks/use-config.js');
var components_datePicker_hooks_useTableData = require('../hooks/use-table-data.js');
var components_datePicker_hooks_useDisabledDate = require('../hooks/use-disabled-date.js');
var components_datePicker_panel_extraContent = require('./extra-content.js');
var components_datePicker_panel_panelContent = require('./panel-content.js');
var components_configProvider_useConfig = require('../../config-provider/useConfig.js');
require('../../../chunks/dayjs.min-c4f4ce86.js');
require('../../../chunks/_commonjsHelpers-2e6815bd.js');
require('../../../chunks/log.js');
require('../../../chunks/utils.js');
require('../../../chunks/defineProperty-838e4192.js');
require('../../../chunks/_isIndex-52887d1e.js');
require('../../../chunks/isFunction-91acade7.js');
require('../../../chunks/isObjectLike-c22c7e3b.js');
require('../../../chunks/isSymbol-a38a5184.js');
require('../../config-provider/context.js');
require('lodash');
require('../../../chunks/zh_CN.js');
require('dayjs');
require('../../../chunks/_commonjsHelpers.js');
require('lodash/isObject');
require('../base/Footer.js');
require('../../button/index.js');
require('../../../utils/with-install.js');
require('vue');
require('../../../config.js');
require('../../button/button.js');
require('@ldesign/icons-vue');
require('../../loading/index.js');
require('../../loading/loading.js');
require('../../../utils/dom.js');
require('raf');
require('lodash/isString');
require('../../../utils/easing.js');
require('../../../utils/render-node.js');
require('../../../utils/transfer-dom.js');
require('../../config-provider/config-receiver.js');
require('lodash/mergeWith');
require('../../../utils/mixins.js');
require('../../loading/props.js');
require('../../loading/icon/gradient.js');
require('../../../chunks/set-style.js');
require('../../../chunks/helper2.js');
require('../../loading/plugin.js');
require('../../../utils/ripple.js');
require('../../button/props.js');
require('../../../chunks/helper.js');
require('../base/Header.js');
require('../../jumper/jumper.js');
require('../../../hooks/use-global-icon.js');
require('../../jumper/props.js');
require('../../select/select.js');
require('lodash/isFunction');
require('lodash/debounce');
require('lodash/get');
require('lodash/cloneDeep');
require('lodash/isArray');
require('../../../hooks/use-default-value.js');
require('../../../hooks/use-vmodel.js');
require('lodash/kebabCase');
require('../../../hooks/lnode.js');
require('lodash/isEmpty');
require('lodash/camelCase');
require('../../../hooks/render-lnode.js');
require('../../popup/index.js');
require('../../../utils/map-props.js');
require('../../popup/popup.js');
require('@popperjs/core');
require('../../../utils/helper.js');
require('../../popup/props.js');
require('../../popup/container.js');
require('../../input/index.js');
require('../../input/input.js');
require('../../../utils/event.js');
require('../../input/props.js');
require('../../input/group.js');
require('../../tag/index.js');
require('../../tag/tag.js');
require('../../tag/props.js');
require('../../tag/check-tag.js');
require('../../select-input/index.js');
require('../../select-input/select-input.js');
require('../../select-input/props.js');
require('../../select-input/hooks/use-single.js');
require('lodash/pick');
require('../../select-input/hooks/use-multiple.js');
require('../../tag-input/index.js');
require('../../tag-input/tag-input.js');
require('../../tag-input/props.js');
require('../../tag-input/hooks/use-tag-scroll.js');
require('../../tag-input/hooks/use-tag-list.js');
require('../../tag-input/hooks/use-hover.js');
require('../../tag-input/hooks/use-drag-sorter.js');
require('../../select-input/hooks/use-overlay-innerstyle.js');
require('../../common/fake-arrow.js');
require('../../../hooks/use-form-disabled.js');
require('../../select/option.js');
require('../../checkbox/index.js');
require('../../checkbox/group.js');
require('lodash/intersection');
require('../../checkbox/checkbox.js');
require('../../checkbox/props.js');
require('../../../hooks/use-lazy-load.js');
require('../../../chunks/observe.js');
require('../../../hooks/use-common-classname.js');
require('../../select/utils.js');
require('../../select/props.js');
require('../../select/select-panel.js');
require('../../../hooks/use-virtual-scroll.js');
require('../../select/hooks/use-select-options.js');
require('../base/Table.js');
require('../base/Cell.js');
require('../../time-picker/panel/time-picker-panel.js');
require('../../../chunks/single-panel.js');
require('lodash/range');
require('lodash/padStart');
require('../../time-picker/panel/props.js');
require('../../time-picker/props.js');

var TSinglePanel = VueCompositionAPI.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 = hooks_useConfig.usePrefixClass("date-picker__panel");
    const {
      global
    } = components_configProvider_useConfig.useConfig("datePicker");
    const {
      format: format$1
    } = format.getDefaultFormat({
      mode: props.mode,
      format: props.format,
      enableTimePicker: props.enableTimePicker
    });
    const disableDateOptions = components_datePicker_hooks_useDisabledDate["default"]({
      format: format$1,
      mode: props.mode,
      disableDate: props.disableDate
    });
    const tableData = VueCompositionAPI.computed(() => components_datePicker_hooks_useTableData["default"]({
      year: props.year,
      month: props.month,
      mode: props.mode,
      start: props.value ? format.parseToDayjs(props.value, format$1).toDate() : void 0,
      firstDayOfWeek: props.firstDayOfWeek || global.value.firstDayOfWeek,
      ...disableDateOptions
    }));
    const panelContentProps = VueCompositionAPI.computed(() => ({
      format: format$1,
      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 = VueCompositionAPI.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(components_datePicker_panel_extraContent["default"], {
      "props": {
        ...extraProps
      }
    }) : null, h(components_datePicker_panel_panelContent["default"], {
      "props": {
        ...panelContentProps
      }
    }), ["bottom", "right"].includes(this.presetsPlacement) ? h(components_datePicker_panel_extraContent["default"], {
      "props": {
        ...extraProps
      }
    }) : null]);
  }
});

exports["default"] = TSinglePanel;
//# sourceMappingURL=single-panel.js.map
