/**
 * ldesign v0.4.6
 * (c) 2023 ldesign
 * @license MIT
 */

import _defineProperty from '@babel/runtime/helpers/defineProperty';
import { defineComponent, computed } from '@vue/composition-api';
import { usePrefixClass } from '../../hooks/useConfig.js';
import { getDefaultFormat, parseToDayjs } from '../../_common/js/date-picker/format.js';
import useTableData from '../hooks/useTableData.js';
import useDisableDate from '../hooks/useDisableDate.js';
import TExtraContent from './ExtraContent.js';
import TPanelContent from './PanelContent.js';
import { useConfig } from '../../config-provider/useConfig.js';
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 '@babel/runtime/helpers/typeof';
import '../../_chunks/dep-be599ec8.js';
import 'dayjs';
import '../../_chunks/dep-67ff4010.js';
import '../../config-provider/type.js';
import 'lodash/isString';
import '../../_common/js/log/index.js';
import '../../_common/js/log/log.js';
import '../../_common/js/date-picker/utils.js';
import '@babel/runtime/helpers/slicedToArray';
import '@babel/runtime/helpers/objectDestructuringEmpty';
import '@babel/runtime/helpers/extends';
import 'lodash/isFunction';
import '../../_chunks/dep-2de45821.js';
import 'lodash/chunk';
import 'lodash/isObject';
import '../base/Footer.js';
import '../../button/index.js';
import '../../utils/withInstall.js';
import 'vue';
import 'lodash/capitalize';
import '../../button/button.js';
import '../../loading/index.js';
import '../../loading/directive.js';
import 'lodash/mapKeys';
import 'lodash/isEqual';
import '../../loading/plugin.js';
import '../../config.js';
import '../../utils/dom.js';
import 'raf';
import '../../utils/easing.js';
import '../../loading/loading.js';
import '../../utils/render-tnode.js';
import 'lodash/camelCase';
import 'lodash/kebabCase';
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 '../../_common/js/loading/circle-adapter.js';
import '../../_common/js/utils/set-style.js';
import '../../_common/js/utils/helper.js';
import '@babel/runtime/helpers/toConsumableArray';
import '@babel/runtime/helpers/objectWithoutProperties';
import 'lodash/isNull';
import 'lodash/isUndefined';
import 'lodash/isNumber';
import 'lodash/isArray';
import '../../loading/style';
import '../../loading/type.js';
import '../../utils/ripple.js';
import '../../button/props.js';
import '../../button/style';
import '../../button/type.js';
import '../../_chunks/dep-c89aafbb.js';
import '../base/Header.js';
import '../../pagination/index.js';
import '../../utils/map-props.js';
import '../../pagination/pagination.js';
import '@ldesign/icons-vue';
import '../../input-number/index.js';
import '../../input-number/input-number.js';
import '../../input/index.js';
import '../../input/input.js';
import '../../utils/helper.js';
import '../../utils/event.js';
import '../../input/props.js';
import '../../input/input-group.js';
import '../../input/style';
import '../../input/type.js';
import '../../hooks/useGlobalIcon.js';
import '../../input-number/props.js';
import '../../input-number/useInputNumber.js';
import '../../hooks/useCommonClassName.js';
import '../../hooks/useVModel.js';
import '../../_common/js/input-number/number.js';
import 'lodash/isNil';
import '../../_common/js/input-number/large-number.js';
import '../../hooks/useFormDisabled.js';
import '../../input-number/style';
import '../../input-number/type.js';
import '../../select/index.js';
import '../../select/select.js';
import 'lodash/debounce';
import 'lodash/get';
import 'lodash/cloneDeep';
import '../../hooks/useDefaultValue.js';
import '../../hooks/tnode.js';
import 'lodash/isEmpty';
import '../../hooks/render-tnode.js';
import '../../popup/index.js';
import '../../popup/popup.js';
import '@popperjs/core';
import '../../popup/props.js';
import '../../popup/container.js';
import '../../popup/utils.js';
import '../../popup/trigger.js';
import '../../popup/style';
import '../../popup/type.js';
import '../../popup/plugin.js';
import '../../tag/index.js';
import '../../tag/tag.js';
import '../../tag/props.js';
import '../../tag/check-tag.js';
import '../../tag/check-tag-props.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/useSingle.js';
import 'lodash/pick';
import '../../select-input/useMultiple.js';
import '../../tag-input/index.js';
import '../../tag-input/tag-input.js';
import '../../tag-input/props.js';
import '../../tag-input/hooks/useTagScroll.js';
import '../../tag-input/useTagList.js';
import '../../tag-input/hooks/useHover.js';
import '../../tag-input/hooks/useDragSorter.js';
import '../../tag-input/style';
import '../../tag-input/type.js';
import '../../tag-input/interface.js';
import '../../select-input/useOverlayInnerStyle.js';
import '../../select-input/style';
import '../../select-input/type.js';
import '../../common-components/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 '../../checkbox/checkbox-group-props.js';
import '../../checkbox/style';
import '../../checkbox/type.js';
import '../../hooks/useLazyLoad.js';
import '../../_common/js/utils/observe.js';
import '../../select/util.js';
import '../../select/option-props.js';
import '../../select/select-panel.js';
import '../../hooks/useVirtualScroll.js';
import '../../select/hooks/useSelectOptions.js';
import '../../select/props.js';
import '../../select/optionGroup.js';
import '../../select/option-group-props.js';
import '../../select/style';
import '../../select/type.js';
import '../../input-adornment/index.js';
import '../../input-adornment/input-adornment.js';
import '../../input-adornment/props.js';
import '../../input-adornment/style';
import '../../input-adornment/type.js';
import '../../pagination/props.js';
import '../../pagination/pagination-mini.js';
import '../../pagination/pagination-mini-props.js';
import '../../pagination/style';
import '../../pagination/type.js';
import '../base/Table.js';
import '../base/Cell.js';
import '../../time-picker/panel/time-picker-panel.js';
import '../../_common/js/time-picker/const.js';
import '../../time-picker/panel/single-panel.js';
import 'lodash/range';
import 'lodash/padStart';
import '../../_common/js/time-picker/utils.js';
import '../../time-picker/panel/props.js';
import '../../time-picker/props.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 TSinglePanel = defineComponent({
  name: "TSinglePanel",
  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: function setup(props) {
    var COMPONENT_NAME = usePrefixClass("date-picker__panel");
    var _useConfig = useConfig("datePicker"),
      global = _useConfig.global;
    var _getDefaultFormat = getDefaultFormat({
        mode: props.mode,
        format: props.format,
        enableTimePicker: props.enableTimePicker
      }),
      format = _getDefaultFormat.format;
    var disableDateOptions = computed(function () {
      return useDisableDate({
        format: format,
        mode: props.mode,
        disableDate: props.disableDate
      });
    });
    var tableData = computed(function () {
      return useTableData(_objectSpread({
        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));
    });
    var panelContentProps = computed(function () {
      return {
        format: 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
      };
    });
    var extraProps = computed(function () {
      return {
        presets: props.presets,
        enableTimePicker: props.enableTimePicker,
        presetsPlacement: props.presetsPlacement,
        onPresetClick: props.onPresetClick,
        onConfirmClick: props.onConfirmClick,
        selectedValue: props.value
      };
    });
    return {
      COMPONENT_NAME: COMPONENT_NAME,
      panelContentProps: panelContentProps,
      extraProps: extraProps
    };
  },
  render: function render() {
    var _this = this;
    var h = arguments[0];
    var COMPONENT_NAME = this.COMPONENT_NAME,
      panelContentProps = this.panelContentProps,
      extraProps = this.extraProps;
    return h("div", {
      "class": [COMPONENT_NAME, _defineProperty({}, "".concat(COMPONENT_NAME, "--direction-row"), ["left", "right"].includes(this.presetsPlacement))],
      "on": {
        "click": function click(e) {
          var _this$onPanelClick;
          return (_this$onPanelClick = _this.onPanelClick) === null || _this$onPanelClick === void 0 ? void 0 : _this$onPanelClick.call(_this, {
            e: e
          });
        }
      }
    }, [["top", "left"].includes(this.presetsPlacement) ? h(TExtraContent, {
      "props": _objectSpread({}, extraProps)
    }) : null, h(TPanelContent, {
      "props": _objectSpread({}, panelContentProps)
    }), ["bottom", "right"].includes(this.presetsPlacement) ? h(TExtraContent, {
      "props": _objectSpread({}, extraProps)
    }) : null]);
  }
});

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