@vrx-arco/pro-components
Version:
<p align="center"> <img src="https://vrx-arco.github.io/arco-design-pro/favicon.svg" width="200" height="250"> </p>
86 lines (85 loc) • 2.95 kB
JavaScript
;
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const vue = require("vue");
const webVue = require("@arco-design/web-vue");
const use = require("@vrx-arco/use");
const _var = require("../style/var.js");
const props = require("./props.js");
function _isSlot(s) {
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !vue.isVNode(s);
}
const ProPagination = /* @__PURE__ */ vue.defineComponent({
name: "vrx-arco-pro-pagination",
props: props.proPaginationProps(),
emits: {
// @ts-ignore
// eslint-disable-next-line @typescript-eslint/no-unused-vars
currentChange: (current) => true,
// @ts-ignore
// eslint-disable-next-line @typescript-eslint/no-unused-vars
pageSizeChange: (pageSize) => true
},
setup: (props2, {
emit,
slots
}) => {
const {
bemClass
} = _var.style("pro-pagination");
const data = vue.toRef(props2, "data");
const pagination = vue.toRef(props2, "pagination");
const paginationProps = vue.toRef(props2, "paginationProps");
const {
total,
current,
pageSize,
data: list,
pageChange,
pageSizeChange
} = use.useProPagination(data, pagination, paginationProps);
return () => {
var _a, _b;
const slotsHeader = (_a = slots.header) == null ? void 0 : _a.call(slots);
return pagination.value ? vue.createVNode(webVue.Layout, {
"class": bemClass()
}, {
default: () => [slotsHeader && vue.createVNode(webVue.Layout.Header, {
"class": bemClass("__header")
}, _isSlot(slotsHeader) ? slotsHeader : {
default: () => [slotsHeader]
}), vue.createVNode(webVue.Layout.Content, {
"class": bemClass("__content")
}, {
default: () => {
var _a2;
return [(_a2 = slots.default) == null ? void 0 : _a2.call(slots, list.value)];
}
}), vue.createVNode(webVue.Layout.Footer, {
"class": bemClass("__footer")
}, {
default: () => [vue.createVNode(webVue.Pagination, vue.mergeProps({
"class": bemClass("__pagination"),
"showTotal": true,
"showPageSize": true,
"showJumper": true
}, paginationProps.value, {
"total": total.value,
"current": current.value,
"pageSize": pageSize.value,
"onChange": (current2) => {
pageChange(current2);
emit("currentChange", current2);
},
"onPageSizeChange": (pageSize2) => {
pageSizeChange(pageSize2);
emit("pageSizeChange", pageSize2);
}
}), null)]
})]
}) : vue.createVNode("div", {
"class": bemClass()
}, [(_b = slots.default) == null ? void 0 : _b.call(slots, list.value)]);
};
}
});
exports.ProPagination = ProPagination;