/**
 * ldesign v0.2.2
 * (c) 2022年9月20日 swimly
 * @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/use-config.js');
var components_button_index = require('../../button/index.js');
var components_configProvider_useConfig = require('../../config-provider/useConfig.js');
require('../../config-provider/context.js');
require('lodash');
require('../../../chunks/zh_CN.js');
require('../../button/button.js');
require('@ldesign/icons-vue');
require('../../loading/index.js');
require('../../loading/loading.js');
require('../../loading/icon/gradient.js');
require('vue');
require('../../../chunks/defineProperty-28395935.js');
require('../../../chunks/set-style.js');
require('../../../chunks/helper2.js');
require('@babel/runtime/helpers/toConsumableArray');
require('@babel/runtime/helpers/slicedToArray');
require('../../../config.js');
require('../../../utils/dom.js');
require('raf');
require('lodash/isString');
require('../../../utils/easing.js');
require('../../../utils/render-node.js');
require('@babel/runtime/helpers/typeof');
require('lodash/camelCase');
require('lodash/kebabCase');
require('../../../utils/transfer-dom.js');
require('../../loading/props.js');
require('../../config-provider/config-receiver.js');
require('lodash/mergeWith');
require('../../../utils/mixins.js');
require('../../../utils/with-install.js');
require('../../loading/plugin.js');
require('../../button/props.js');
require('../../../utils/ripple.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 TDateFooter = VueCompositionAPI.defineComponent({
  name: "LDatePickerTable",
  components: {
    LButton: components_button_index.Button
  },
  props: {
    enableTimePicker: Boolean,
    presetsPlacement: String,
    presets: Object,
    selectedValue: [Date, String, Number],
    onPresetClick: Function,
    onConfirmClick: Function
  },
  setup: function setup(props) {
    var COMPONENT_NAME = hooks_useConfig.usePrefixClass("date-picker__footer");
    var presetsClass = hooks_useConfig.usePrefixClass("date-picker__presets");

    var _useConfig = components_configProvider_useConfig.useConfig("datePicker"),
        t = _useConfig.t,
        global = _useConfig.global;

    var footerClass = VueCompositionAPI.computed(function () {
      return [COMPONENT_NAME.value, "".concat(COMPONENT_NAME.value, "--").concat(props.presetsPlacement)];
    });
    return {
      footerClass: footerClass,
      presetsClass: presetsClass,
      global: global,
      t: t
    };
  },
  render: function render() {
    var _this = this;

    var h = arguments[0];
    var footerClass = this.footerClass,
        presetsClass = this.presetsClass,
        global = this.global,
        t = this.t;
    return h("div", {
      "class": footerClass
    }, [h("div", {
      "class": presetsClass
    }, [this.presets && Object.keys(this.presets).map(function (key) {
      return h("l-button", {
        "key": key,
        "attrs": {
          "size": "small",
          "variant": "text"
        },
        "on": {
          "click": function click(e) {
            var _this$onPresetClick;

            return (_this$onPresetClick = _this.onPresetClick) === null || _this$onPresetClick === void 0 ? void 0 : _this$onPresetClick.call(_this, _this.presets[key], {
              e: e
            });
          }
        }
      }, [key]);
    })]), this.enableTimePicker && h("l-button", {
      "props": _objectSpread({}, {
        size: "small",
        theme: "primary",
        disabled: !this.selectedValue,
        onClick: function onClick(e) {
          var _this$onConfirmClick;

          return (_this$onConfirmClick = _this.onConfirmClick) === null || _this$onConfirmClick === void 0 ? void 0 : _this$onConfirmClick.call(_this, {
            e: e
          });
        }
      })
    }, [t(global.confirm)])]);
  }
});

exports["default"] = TDateFooter;
//# sourceMappingURL=Footer.js.map
