/**
 * tdesign v0.46.4
 * (c) 2022 tdesign
 * @license MIT
 */

'use strict';

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

var _defineProperty = require('@babel/runtime/helpers/defineProperty');
var VueCompositionAPI = require('@vue/composition-api');
var isObject = require('lodash/isObject');
var tdesignIconsVue = require('tdesign-icons-vue');
var jumper_props = require('./props.js');
var hooks_useConfig = require('../hooks/useConfig.js');
var hooks_useGlobalIcon = require('../hooks/useGlobalIcon.js');
var button_index = require('../button/index.js');
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('../button/button.js');
require('../loading/index.js');
require('../loading/loading.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('@babel/runtime/helpers/slicedToArray');
require('../config-provider/config-receiver.js');
require('vue');
require('../utils/mixins.js');
require('../utils/dom.js');
require('raf');
require('lodash/isString');
require('../utils/easing.js');
require('../utils/render-tnode.js');
require('@babel/runtime/helpers/typeof');
require('lodash/camelCase');
require('lodash/kebabCase');
require('../utils/transfer-dom.js');
require('../loading/props.js');
require('../utils/withInstall.js');
require('lodash/capitalize');
require('../loading/plugin.js');
require('../config.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);
var isObject__default = /*#__PURE__*/_interopDefaultLegacy(isObject);

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 TJumper = VueCompositionAPI.defineComponent({
  name: "TJumper",
  props: _objectSpread({}, jumper_props["default"]),
  setup: function setup(props2, _ref) {
    var emit = _ref.emit;
    var COMPONENT_NAME = hooks_useConfig.usePrefixClass("jumper");

    var _useGlobalIcon = hooks_useGlobalIcon.useGlobalIcon({
      ChevronLeftIcon: tdesignIconsVue.ChevronLeftIcon,
      RoundIcon: tdesignIconsVue.RoundIcon,
      ChevronRightIcon: tdesignIconsVue.ChevronRightIcon,
      ChevronUpIcon: tdesignIconsVue.ChevronUpIcon,
      ChevronDownIcon: tdesignIconsVue.ChevronDownIcon
    }),
        ChevronLeftIcon = _useGlobalIcon.ChevronLeftIcon,
        RoundIcon = _useGlobalIcon.RoundIcon,
        ChevronRightIcon = _useGlobalIcon.ChevronRightIcon,
        ChevronUpIcon = _useGlobalIcon.ChevronUpIcon,
        ChevronDownIcon = _useGlobalIcon.ChevronDownIcon;

    var titleConfig = VueCompositionAPI.computed(function () {
      if (isObject__default["default"](props2.tips)) return props2.tips;
      if (props2.tips === true) return {
        prev: "\u4E0A\u4E00\u9875",
        current: "\u5F53\u524D",
        next: "\u4E0B\u4E00\u9875"
      };
      return {};
    });
    var disabledConfig = VueCompositionAPI.computed(function () {
      if (isObject__default["default"](props2.disabled)) return props2.disabled;
      if (props2.disabled === true) return {
        prev: true,
        current: true,
        next: true
      };
      return {
        prev: false,
        current: false,
        next: false
      };
    });

    function handleChange(context) {
      var _props2$onChange;

      emit("change", context);
      (_props2$onChange = props2.onChange) === null || _props2$onChange === void 0 ? void 0 : _props2$onChange.call(props2, context);
    }

    return {
      COMPONENT_NAME: COMPONENT_NAME,
      ChevronLeftIcon: ChevronLeftIcon,
      RoundIcon: RoundIcon,
      ChevronRightIcon: ChevronRightIcon,
      ChevronUpIcon: ChevronUpIcon,
      ChevronDownIcon: ChevronDownIcon,
      titleConfig: titleConfig,
      disabledConfig: disabledConfig,
      handleChange: handleChange
    };
  },
  render: function render() {
    var h = arguments[0];
    var COMPONENT_NAME = this.COMPONENT_NAME,
        ChevronLeftIcon = this.ChevronLeftIcon,
        RoundIcon = this.RoundIcon,
        ChevronRightIcon = this.ChevronRightIcon,
        ChevronUpIcon = this.ChevronUpIcon,
        ChevronDownIcon = this.ChevronDownIcon,
        titleConfig = this.titleConfig,
        disabledConfig = this.disabledConfig,
        handleChange = this.handleChange;
    var jumperClass = [COMPONENT_NAME, _defineProperty__default["default"]({}, "".concat(COMPONENT_NAME, "--outline"), this.variant === "outline")];
    return h("div", {
      "class": jumperClass
    }, [h(button_index.Button, {
      "attrs": {
        "title": titleConfig.prev,
        "variant": this.variant,
        "size": this.size,
        "shape": "square",
        "icon": this.layout === "horizontal" ? function () {
          return h(ChevronLeftIcon);
        } : function () {
          return h(ChevronUpIcon);
        },
        "disabled": disabledConfig.prev
      },
      "on": {
        "click": function click(e) {
          return handleChange({
            e: e,
            trigger: "prev"
          });
        }
      },
      "class": "".concat(COMPONENT_NAME, "__prev")
    }), this.showCurrent && h(button_index.Button, {
      "attrs": {
        "title": titleConfig.current,
        "variant": this.variant,
        "size": this.size,
        "shape": "square",
        "icon": function icon() {
          return h(RoundIcon);
        },
        "disabled": disabledConfig.current
      },
      "on": {
        "click": function click(e) {
          return handleChange({
            e: e,
            trigger: "current"
          });
        }
      },
      "class": "".concat(COMPONENT_NAME, "__current")
    }), h(button_index.Button, {
      "attrs": {
        "title": titleConfig.next,
        "variant": this.variant,
        "size": this.size,
        "shape": "square",
        "icon": this.layout === "horizontal" ? function () {
          return h(ChevronRightIcon);
        } : function () {
          return h(ChevronDownIcon);
        },
        "disabled": disabledConfig.next
      },
      "on": {
        "click": function click(e) {
          return handleChange({
            e: e,
            trigger: "next"
          });
        }
      },
      "class": "".concat(COMPONENT_NAME, "__next")
    })]);
  }
});

exports["default"] = TJumper;
//# sourceMappingURL=jumper.js.map
