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

'use strict';

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

var _defineProperty = require('@babel/runtime/helpers/defineProperty');
var VueCompositionAPI = require('@vue/composition-api');
var hooks_useConfig = require('../../hooks/useConfig.js');
var _common_js_datePicker_format = require('../../_common/js/date-picker/format.js');
var datePicker_hooks_useTableData = require('../hooks/useTableData.js');
var datePicker_hooks_useDisableDate = require('../hooks/useDisableDate.js');
var datePicker_panel_ExtraContent = require('./ExtraContent.js');
var datePicker_panel_PanelContent = require('./PanelContent.js');
var configProvider_useConfig = require('../../config-provider/useConfig.js');
require('../../config-provider/context.js');
require('lodash/merge');
require('lodash/mergeWith');
require('../../_common/js/global-config/default-config.js');
require('../../_common/js/global-config/locale/zh_CN.js');
require('@babel/runtime/helpers/typeof');
require('../../_chunks/dep-7c884501.js');
require('dayjs');
require('lodash/isString');
require('../../_common/js/log/log.js');
require('../../_common/js/date-picker/utils.js');
require('@babel/runtime/helpers/slicedToArray');
require('@babel/runtime/helpers/objectDestructuringEmpty');
require('@babel/runtime/helpers/extends');
require('lodash/isFunction');
require('../../_chunks/dep-6e3fbdd7.js');
require('lodash/chunk');
require('lodash/isObject');
require('../base/Footer.js');
require('../../button/index.js');
require('../../utils/withInstall.js');
require('vue');
require('lodash/capitalize');
require('../../button/button.js');
require('../../loading/index.js');
require('../../loading/directive.js');
require('lodash/mapKeys');
require('lodash/isEqual');
require('../../loading/plugin.js');
require('../../config.js');
require('../../utils/dom.js');
require('raf');
require('../../utils/easing.js');
require('../../loading/loading.js');
require('../../utils/render-tnode.js');
require('lodash/camelCase');
require('lodash/kebabCase');
require('../../utils/transfer-dom.js');
require('../../config-provider/config-receiver.js');
require('../../utils/mixins.js');
require('../../loading/props.js');
require('../../loading/icon/gradient.js');
require('../../_common/js/loading/circle-adapter.js');
require('../../_common/js/utils/set-style.js');
require('../../_common/js/utils/helper.js');
require('@babel/runtime/helpers/toConsumableArray');
require('@babel/runtime/helpers/objectWithoutProperties');
require('lodash/isNull');
require('lodash/isUndefined');
require('lodash/isNumber');
require('lodash/isArray');
require('../../utils/ripple.js');
require('../../button/props.js');
require('../../_chunks/dep-c3e1ffac.js');
require('../base/Header.js');
require('../../pagination/index.js');
require('../../utils/map-props.js');
require('../../pagination/pagination.js');
require('@ldesign/icons-vue');
require('../../input-number/index.js');
require('../../input-number/input-number.js');
require('../../input/index.js');
require('../../input/input.js');
require('../../utils/helper.js');
require('../../utils/event.js');
require('../../input/props.js');
require('../../input/input-group.js');
require('../../hooks/useGlobalIcon.js');
require('../../input-number/props.js');
require('../../input-number/useInputNumber.js');
require('../../hooks/useCommonClassName.js');
require('../../hooks/useVModel.js');
require('../../_common/js/input-number/number.js');
require('lodash/isNil');
require('../../_common/js/input-number/large-number.js');
require('../../hooks/useFormDisabled.js');
require('../../select/index.js');
require('../../select/select.js');
require('lodash/debounce');
require('lodash/get');
require('lodash/cloneDeep');
require('../../hooks/useDefaultValue.js');
require('../../hooks/tnode.js');
require('lodash/isEmpty');
require('../../hooks/render-tnode.js');
require('../../popup/index.js');
require('../../popup/popup.js');
require('@popperjs/core');
require('../../popup/props.js');
require('../../popup/container.js');
require('../../popup/utils.js');
require('../../popup/trigger.js');
require('../../popup/plugin.js');
require('../../tag/index.js');
require('../../tag/tag.js');
require('../../tag/props.js');
require('../../tag/check-tag.js');
require('../../tag/check-tag-props.js');
require('../../select-input/index.js');
require('../../select-input/select-input.js');
require('../../select-input/props.js');
require('../../select-input/useSingle.js');
require('lodash/pick');
require('../../select-input/useMultiple.js');
require('../../tag-input/index.js');
require('../../tag-input/tag-input.js');
require('../../tag-input/props.js');
require('../../tag-input/hooks/useTagScroll.js');
require('../../tag-input/useTagList.js');
require('../../tag-input/hooks/useHover.js');
require('../../tag-input/hooks/useDragSorter.js');
require('../../select-input/useOverlayInnerStyle.js');
require('../../common-components/fake-arrow.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('../../checkbox/checkbox-group-props.js');
require('../../hooks/useLazyLoad.js');
require('../../_common/js/utils/observe.js');
require('../../select/util.js');
require('../../select/option-props.js');
require('../../select/select-panel.js');
require('../../hooks/useVirtualScroll.js');
require('../../select/hooks/useSelectOptions.js');
require('../../select/props.js');
require('../../select/optionGroup.js');
require('../../select/option-group-props.js');
require('../../input-adornment/index.js');
require('../../input-adornment/input-adornment.js');
require('../../input-adornment/props.js');
require('../../pagination/props.js');
require('../../pagination/pagination-mini.js');
require('../../pagination/pagination-mini-props.js');
require('../base/Table.js');
require('../base/Cell.js');
require('../../time-picker/panel/time-picker-panel.js');
require('../../_common/js/time-picker/const.js');
require('../../time-picker/panel/single-panel.js');
require('lodash/range');
require('lodash/padStart');
require('../../_common/js/time-picker/utils.js');
require('../../time-picker/panel/props.js');
require('../../time-picker/props.js');

function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);

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__default["default"](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 = VueCompositionAPI.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 = hooks_useConfig.usePrefixClass("date-picker__panel");
    var _useConfig = configProvider_useConfig.useConfig("datePicker"),
      global = _useConfig.global;
    var _getDefaultFormat = _common_js_datePicker_format.getDefaultFormat({
        mode: props.mode,
        format: props.format,
        enableTimePicker: props.enableTimePicker
      }),
      format = _getDefaultFormat.format;
    var disableDateOptions = VueCompositionAPI.computed(function () {
      return datePicker_hooks_useDisableDate["default"]({
        format: format,
        mode: props.mode,
        disableDate: props.disableDate
      });
    });
    var tableData = VueCompositionAPI.computed(function () {
      return datePicker_hooks_useTableData["default"](_objectSpread({
        year: props.year,
        month: props.month,
        mode: props.mode,
        start: props.value ? _common_js_datePicker_format.parseToDayjs(props.value, format).toDate() : void 0,
        firstDayOfWeek: props.firstDayOfWeek || global.value.firstDayOfWeek
      }, disableDateOptions.value));
    });
    var panelContentProps = VueCompositionAPI.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 = VueCompositionAPI.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__default["default"]({}, "".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(datePicker_panel_ExtraContent["default"], {
      "props": _objectSpread({}, extraProps)
    }) : null, h(datePicker_panel_PanelContent["default"], {
      "props": _objectSpread({}, panelContentProps)
    }), ["bottom", "right"].includes(this.presetsPlacement) ? h(datePicker_panel_ExtraContent["default"], {
      "props": _objectSpread({}, extraProps)
    }) : null]);
  }
});

exports["default"] = TSinglePanel;
//# sourceMappingURL=SinglePanel.js.map
