UNPKG

yuang-framework-ui-pc

Version:

yuang-framework-ui-pc Library

97 lines (96 loc) 3.5 kB
"use strict"; const vue = require("vue"); const elementPlus = require("element-plus"); const props = require("./props"); const _sfc_main = vue.defineComponent({ name: "ElePagination", components: { ElPagination: elementPlus.ElPagination }, props: props.paginationProps, emits: props.paginationEmits, setup(props2, { emit }) { const isInfinite = vue.computed(() => "*" === props2.total); const pageTotal = vue.computed(() => { if (isInfinite.value) { if (props2.hasNext) { return Number.MAX_SAFE_INTEGER; } return (props2.currentPage || 1) * (props2.pageSize || 10); } const num = props2.total == null ? void 0 : Number(props2.total); return num == null || isNaN(num) ? void 0 : num; }); const sizesPopperClass = vue.computed(() => { const classes = ["ele-pagination-popper"]; if (props2.isFixedPopper) { classes.push("is-fixed"); } if (typeof props2.popperClass === "string" && props2.popperClass) { classes.push(props2.popperClass); } return classes.join(" "); }); const handleUpdateCurrentPage = (currentPage) => { emit("update:currentPage", currentPage); }; const handleUpdatePageSize = (pageSize) => { emit("update:pageSize", pageSize); }; return { isInfinite, pageTotal, sizesPopperClass, handleUpdateCurrentPage, handleUpdatePageSize }; } }); const _export_sfc = (sfc, props2) => { const target = sfc.__vccOpts || sfc; for (const [key, val] of props2) { target[key] = val; } return target; }; function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) { const _component_ElPagination = vue.resolveComponent("ElPagination"); return vue.openBlock(), vue.createBlock(_component_ElPagination, { small: _ctx.small, size: _ctx.size, background: _ctx.type === "circle" ? false : _ctx.background, pageSize: _ctx.pageSize, defaultPageSize: _ctx.defaultPageSize, total: _ctx.pageTotal, pageCount: _ctx.pageCount, pagerCount: _ctx.pagerCount, currentPage: _ctx.currentPage, defaultCurrentPage: _ctx.defaultCurrentPage, layout: _ctx.layout, pageSizes: _ctx.pageSizes, popperClass: _ctx.sizesPopperClass, prevText: _ctx.prevText, prevIcon: _ctx.prevIcon, nextText: _ctx.nextText, nextIcon: _ctx.nextIcon, disabled: _ctx.disabled, teleported: _ctx.teleported, hideOnSinglePage: _ctx.hideOnSinglePage, class: vue.normalizeClass([ "ele-pagination", { "is-circle": _ctx.type === "circle" }, { "is-infinite": _ctx.isInfinite } ]), "onUpdate:currentPage": _ctx.handleUpdateCurrentPage, "onUpdate:pageSize": _ctx.handleUpdatePageSize }, vue.createSlots({ _: 2 }, [ vue.renderList(Object.keys(_ctx.$slots), (name) => { return { name, fn: vue.withCtx((slotProps) => [ vue.renderSlot(_ctx.$slots, name, vue.normalizeProps(vue.guardReactiveProps(slotProps || {}))) ]) }; }) ]), 1032, ["small", "size", "background", "pageSize", "defaultPageSize", "total", "pageCount", "pagerCount", "currentPage", "defaultCurrentPage", "layout", "pageSizes", "popperClass", "prevText", "prevIcon", "nextText", "nextIcon", "disabled", "teleported", "hideOnSinglePage", "class", "onUpdate:currentPage", "onUpdate:pageSize"]); } const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]); module.exports = index;