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

import { defineComponent, computed } from '@vue/composition-api';
import isObject from 'lodash/isObject';
import { ChevronLeftIcon, RoundIcon, ChevronRightIcon, ChevronUpIcon, ChevronDownIcon } from '@ldesign/icons-vue';
import { usePrefixClass } from '../../hooks/use-config.js';
import { useGlobalIcon } from '../../hooks/use-global-icon.js';
import { Button } from '../button/index.js';
import props from './props.js';
import '../config-provider/useConfig.js';
import '../config-provider/context.js';
import 'lodash';
import '../../_chunks/dep-def4c2ce.js';
import '../../utils/with-install.js';
import 'vue';
import '../../config.js';
import '../button/button.js';
import '../loading/index.js';
import '../loading/loading.js';
import '../../utils/dom.js';
import 'raf';
import 'lodash/isString';
import '../../_chunks/dep-70c789e5.js';
import '../../_chunks/dep-5210251b.js';
import '../../utils/easing.js';
import '../../utils/render-node.js';
import '../../utils/transfer-dom.js';
import '../config-provider/config-receiver.js';
import 'lodash/mergeWith';
import '../../utils/mixins.js';
import '../loading/props.js';
import '../loading/icon/gradient.js';
import '../../_chunks/dep-eb467ddf.js';
import '../../_chunks/dep-cf772670.js';
import '../../_chunks/dep-47d77fc8.js';
import '../loading/plugin.js';
import '../../utils/ripple.js';
import '../button/props.js';

const defaultTipsConfig = {
  prev: "\u4E0A\u4E00\u9875",
  current: "\u5F53\u524D",
  next: "\u4E0B\u4E00\u9875"
};
var _Jumper = defineComponent({
  name: "LJumper",
  components: {
    LButton: Button
  },
  props: {
    ...props
  },
  setup(props2, _ref) {
    let {
      emit
    } = _ref;
    const COMPONENT_NAME = usePrefixClass("jumper");
    const {
      ChevronLeftIcon: ChevronLeftIcon$1,
      RoundIcon: RoundIcon$1,
      ChevronRightIcon: ChevronRightIcon$1,
      ChevronUpIcon: ChevronUpIcon$1,
      ChevronDownIcon: ChevronDownIcon$1
    } = useGlobalIcon({
      ChevronLeftIcon: ChevronLeftIcon,
      RoundIcon: RoundIcon,
      ChevronRightIcon: ChevronRightIcon,
      ChevronUpIcon: ChevronUpIcon,
      ChevronDownIcon: ChevronDownIcon
    });
    const titleConfig = computed(() => {
      if (isObject(props2.tips)) return props2.tips;
      if (props2.tips === true) return defaultTipsConfig;
      return {};
    });
    const disabledConfig = computed(() => {
      if (isObject(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,
      ChevronLeftIcon: ChevronLeftIcon$1,
      RoundIcon: RoundIcon$1,
      ChevronRightIcon: ChevronRightIcon$1,
      ChevronUpIcon: ChevronUpIcon$1,
      ChevronDownIcon: ChevronDownIcon$1,
      titleConfig,
      disabledConfig,
      handleChange
    };
  },
  render() {
    const h = arguments[0];
    const {
      COMPONENT_NAME,
      ChevronLeftIcon,
      RoundIcon,
      ChevronRightIcon,
      ChevronUpIcon,
      ChevronDownIcon,
      titleConfig,
      disabledConfig,
      handleChange
    } = this;
    const classes = [COMPONENT_NAME, {
      [`${COMPONENT_NAME}--outline`]: this.variant === "outline"
    }];
    return h("div", {
      "class": classes
    }, [h("l-button", {
      "attrs": {
        "title": titleConfig.prev,
        "variant": this.variant,
        "size": this.size,
        "shape": "square",
        "icon": this.layout === "horizontal" ? () => h(ChevronLeftIcon) : () => h(ChevronUpIcon),
        "disabled": disabledConfig.prev
      },
      "on": {
        "click": e => handleChange({
          e,
          trigger: "prev"
        })
      },
      "class": `${COMPONENT_NAME}__prev`
    }), this.showCurrent && h("l-button", {
      "attrs": {
        "title": titleConfig.current,
        "variant": this.variant,
        "size": this.size,
        "shape": "square",
        "icon": () => h(RoundIcon),
        "disabled": disabledConfig.current
      },
      "on": {
        "click": e => handleChange({
          e,
          trigger: "current"
        })
      },
      "class": `${COMPONENT_NAME}__current`
    }), h("l-button", {
      "attrs": {
        "title": titleConfig.next,
        "variant": this.variant,
        "size": this.size,
        "shape": "square",
        "icon": this.layout === "horizontal" ? () => h(ChevronRightIcon) : () => h(ChevronDownIcon),
        "disabled": disabledConfig.next
      },
      "on": {
        "click": e => handleChange({
          e,
          trigger: "next"
        })
      },
      "class": `${COMPONENT_NAME}__next`
    })]);
  }
});

export { _Jumper as default };
//# sourceMappingURL=jumper.js.map
