import { defineComponent, useAttrs, computed, resolveComponent, createElementBlock, openBlock, mergeProps, unref, createCommentVNode, createElementVNode, normalizeClass, renderSlot, createVNode, withCtx, normalizeProps, Fragment, createBlock, resolveDynamicComponent } from 'vue';
import '../../../utils/index.mjs';
import { omit } from 'lodash-es';
import { paginationProProps } from './pagination-pro.mjs';
import { createNamespace } from '../../../utils/create-namespace.mjs';

"use strict";
var _sfc_main = /* @__PURE__ */ defineComponent({
  ...{ name: "LlPaginationPro", inheritAttrs: false },
  __name: "pagination-pro",
  props: paginationProProps,
  setup(__props) {
    const props = __props;
    const bem = createNamespace("pagination-pro");
    const attrs = useAttrs();
    const containerAttrs = computed(() => ({
      class: attrs.class,
      style: attrs.style
    }));
    const componentAttrs = computed(() => {
      return { ...omit(attrs, ["class", "style"]) };
    });
    const getPagingStyle = computed(() => {
      switch (props.pagingStyle) {
        case "simple":
          return "simple";
        case "solid":
          return "solid";
        case "outline":
          return "outline";
        default:
          return "outline";
      }
    });
    const getPagingOrientation = computed(() => {
      switch (props.alignment) {
        case "left":
          return "left";
        case "center":
          return "center";
        case "right":
          return "right";
        default:
          return "right";
      }
    });
    const handleShowTotal = (total, range) => {
      if (typeof props.showTotal === "function") {
        return props.showTotal(total, range);
      } else {
        return `\u5171 ${total} \u6761`;
      }
    };
    return (_ctx, _cache) => {
      const _component_ll_button = resolveComponent("ll-button");
      const _component_a_pagination = resolveComponent("a-pagination");
      return openBlock(), createElementBlock(
        "div",
        mergeProps(containerAttrs.value, {
          class: [
            unref(bem).b(),
            unref(bem).is(getPagingStyle.value),
            unref(bem).is(_ctx.isGray ? "gray-pagination" : "")
          ]
        }),
        [
          _ctx.$slots.side ? (openBlock(), createElementBlock(
            "div",
            {
              key: 0,
              class: normalizeClass(unref(bem).e("side"))
            },
            [
              renderSlot(_ctx.$slots, "side")
            ],
            2
            /* CLASS */
          )) : createCommentVNode("v-if", true),
          createElementVNode(
            "div",
            {
              class: normalizeClass([unref(bem).e("pagination"), unref(bem).m(getPagingOrientation.value)])
            },
            [
              createVNode(_component_a_pagination, mergeProps(componentAttrs.value, {
                "show-total": _ctx.isShowTotal ? handleShowTotal : void 0
              }), {
                itemRender: withCtx(({ page, type, originalElement }) => [
                  createCommentVNode(" \u81EA\u5B9A\u4E49\u63D2\u69FD "),
                  _ctx.$slots.itemRender ? renderSlot(_ctx.$slots, "itemRender", normalizeProps(mergeProps({ key: 0 }, { page, type, originalElement }))) : (openBlock(), createElementBlock(
                    Fragment,
                    { key: 1 },
                    [
                      createCommentVNode(" \u5185\u7F6E\u63D2\u69FD "),
                      type === "prev" && _ctx.prevIcon ? (openBlock(), createBlock(_component_ll_button, {
                        key: 0,
                        type: "link",
                        class: normalizeClass(["ant-pagination-item-link", unref(bem).m("custom-prev")]),
                        icon: { iconName: _ctx.prevIcon }
                      }, null, 8, ["class", "icon"])) : type === "next" && _ctx.nextIcon ? (openBlock(), createBlock(_component_ll_button, {
                        key: 1,
                        type: "link",
                        class: normalizeClass(["ant-pagination-item-link", unref(bem).m("custom-next")]),
                        icon: { iconName: _ctx.nextIcon }
                      }, null, 8, ["class", "icon"])) : (openBlock(), createBlock(resolveDynamicComponent(originalElement), { key: 2 }))
                    ],
                    64
                    /* STABLE_FRAGMENT */
                  ))
                ]),
                _: 3
                /* FORWARDED */
              }, 16, ["show-total"])
            ],
            2
            /* CLASS */
          )
        ],
        16
        /* FULL_PROPS */
      );
    };
  }
});

export { _sfc_main as default };
//# sourceMappingURL=pagination-pro.vue2.mjs.map
