This commit is contained in:
2025-09-19 14:25:20 +08:00
parent 269893a435
commit fbf3f77229
24949 changed files with 2839404 additions and 0 deletions

View File

@@ -0,0 +1,6 @@
import Pagination from './src/pagination';
import type { SFCWithInstall } from 'element-plus/es/utils';
export declare const ElPagination: SFCWithInstall<typeof Pagination>;
export default ElPagination;
export * from './src/pagination';
export * from './src/constants';

View File

@@ -0,0 +1,9 @@
import Pagination from './src/pagination.mjs';
export { paginationEmits, paginationProps } from './src/pagination.mjs';
export { elPaginationKey } from './src/constants.mjs';
import { withInstall } from '../../utils/vue/install.mjs';
const ElPagination = withInstall(Pagination);
export { ElPagination, ElPagination as default };
//# sourceMappingURL=index.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.mjs","sources":["../../../../../packages/components/pagination/index.ts"],"sourcesContent":["import { withInstall } from '@element-plus/utils'\nimport Pagination from './src/pagination'\n\nimport type { SFCWithInstall } from '@element-plus/utils'\n\nexport const ElPagination: SFCWithInstall<typeof Pagination> =\n withInstall(Pagination)\nexport default ElPagination\n\nexport * from './src/pagination'\nexport * from './src/constants'\n"],"names":[],"mappings":";;;;;AAEY,MAAC,YAAY,GAAG,WAAW,CAAC,UAAU;;;;"}

View File

@@ -0,0 +1,13 @@
import type { ExtractPropTypes, __ExtractPublicPropTypes } from 'vue';
import type Jumper from './jumper.vue';
export declare const paginationJumperProps: {
readonly size: {
readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<StringConstructor, "" | "small" | "default" | "large", unknown>>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
};
export type PaginationJumperProps = ExtractPropTypes<typeof paginationJumperProps>;
export type PaginationJumperPropsPublic = __ExtractPublicPropTypes<typeof paginationJumperProps>;
export type PaginationJumperInstance = InstanceType<typeof Jumper> & unknown;

View File

@@ -0,0 +1,12 @@
import { buildProps } from '../../../../utils/vue/props/runtime.mjs';
import { componentSizes } from '../../../../constants/size.mjs';
const paginationJumperProps = buildProps({
size: {
type: String,
values: componentSizes
}
});
export { paginationJumperProps };
//# sourceMappingURL=jumper.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"jumper.mjs","sources":["../../../../../../../packages/components/pagination/src/components/jumper.ts"],"sourcesContent":["import { buildProps } from '@element-plus/utils'\nimport { componentSizes } from '@element-plus/constants'\n\nimport type { ExtractPropTypes, __ExtractPublicPropTypes } from 'vue'\nimport type Jumper from './jumper.vue'\n\nexport const paginationJumperProps = buildProps({\n size: {\n type: String,\n values: componentSizes,\n },\n} as const)\n\nexport type PaginationJumperProps = ExtractPropTypes<\n typeof paginationJumperProps\n>\nexport type PaginationJumperPropsPublic = __ExtractPublicPropTypes<\n typeof paginationJumperProps\n>\n\nexport type PaginationJumperInstance = InstanceType<typeof Jumper> & unknown\n"],"names":[],"mappings":";;;AAEY,MAAC,qBAAqB,GAAG,UAAU,CAAC;AAChD,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,MAAM,EAAE,cAAc;AAC1B,GAAG;AACH,CAAC;;;;"}

View File

@@ -0,0 +1,16 @@
declare const _default: import("vue").DefineComponent<{
readonly size: {
readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<StringConstructor, "" | "small" | "default" | "large", unknown>>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
readonly size: {
readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<StringConstructor, "" | "small" | "default" | "large", unknown>>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
}>>, {}>;
export default _default;

View File

@@ -0,0 +1,63 @@
import { defineComponent, ref, computed, openBlock, createElementBlock, normalizeClass, unref, createElementVNode, toDisplayString, createVNode } from 'vue';
import { ElInput } from '../../../input/index.mjs';
import { usePagination } from '../usePagination.mjs';
import { paginationJumperProps } from './jumper.mjs';
import _export_sfc from '../../../../_virtual/plugin-vue_export-helper.mjs';
import { useLocale } from '../../../../hooks/use-locale/index.mjs';
import { useNamespace } from '../../../../hooks/use-namespace/index.mjs';
const __default__ = defineComponent({
name: "ElPaginationJumper"
});
const _sfc_main = /* @__PURE__ */ defineComponent({
...__default__,
props: paginationJumperProps,
setup(__props) {
const { t } = useLocale();
const ns = useNamespace("pagination");
const { pageCount, disabled, currentPage, changeEvent } = usePagination();
const userInput = ref();
const innerValue = computed(() => {
var _a;
return (_a = userInput.value) != null ? _a : currentPage == null ? void 0 : currentPage.value;
});
function handleInput(val) {
userInput.value = val ? +val : "";
}
function handleChange(val) {
val = Math.trunc(+val);
changeEvent == null ? void 0 : changeEvent(val);
userInput.value = void 0;
}
return (_ctx, _cache) => {
return openBlock(), createElementBlock("span", {
class: normalizeClass(unref(ns).e("jump")),
disabled: unref(disabled)
}, [
createElementVNode("span", {
class: normalizeClass([unref(ns).e("goto")])
}, toDisplayString(unref(t)("el.pagination.goto")), 3),
createVNode(unref(ElInput), {
size: _ctx.size,
class: normalizeClass([unref(ns).e("editor"), unref(ns).is("in-pagination")]),
min: 1,
max: unref(pageCount),
disabled: unref(disabled),
"model-value": unref(innerValue),
"validate-event": false,
"aria-label": unref(t)("el.pagination.page"),
type: "number",
"onUpdate:modelValue": handleInput,
onChange: handleChange
}, null, 8, ["size", "class", "max", "disabled", "model-value", "aria-label"]),
createElementVNode("span", {
class: normalizeClass([unref(ns).e("classifier")])
}, toDisplayString(unref(t)("el.pagination.pageClassifier")), 3)
], 10, ["disabled"]);
};
}
});
var Jumper = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "jumper.vue"]]);
export { Jumper as default };
//# sourceMappingURL=jumper2.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"jumper2.mjs","sources":["../../../../../../../packages/components/pagination/src/components/jumper.vue"],"sourcesContent":["<template>\n <span :class=\"ns.e('jump')\" :disabled=\"disabled\">\n <span :class=\"[ns.e('goto')]\">{{ t('el.pagination.goto') }}</span>\n <el-input\n :size=\"size\"\n :class=\"[ns.e('editor'), ns.is('in-pagination')]\"\n :min=\"1\"\n :max=\"pageCount\"\n :disabled=\"disabled\"\n :model-value=\"innerValue\"\n :validate-event=\"false\"\n :aria-label=\"t('el.pagination.page')\"\n type=\"number\"\n @update:model-value=\"handleInput\"\n @change=\"handleChange\"\n />\n <span :class=\"[ns.e('classifier')]\">{{\n t('el.pagination.pageClassifier')\n }}</span>\n </span>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed, ref } from 'vue'\nimport { useLocale, useNamespace } from '@element-plus/hooks'\nimport ElInput from '@element-plus/components/input'\nimport { usePagination } from '../usePagination'\nimport { paginationJumperProps } from './jumper'\n\ndefineOptions({\n name: 'ElPaginationJumper',\n})\n\ndefineProps(paginationJumperProps)\nconst { t } = useLocale()\nconst ns = useNamespace('pagination')\nconst { pageCount, disabled, currentPage, changeEvent } = usePagination()\nconst userInput = ref<number | string>()\nconst innerValue = computed(() => userInput.value ?? currentPage?.value)\n\nfunction handleInput(val: number | string) {\n userInput.value = val ? +val : ''\n}\n\nfunction handleChange(val: number | string) {\n val = Math.trunc(+val)\n changeEvent?.(val)\n userInput.value = undefined\n}\n</script>\n"],"names":[],"mappings":";;;;;;;;mCA6Bc,CAAA;AAAA,EACZ,IAAM,EAAA,oBAAA;AACR,CAAA,CAAA,CAAA;;;;;AAGA,IAAM,MAAA,EAAE,CAAE,EAAA,GAAI,SAAU,EAAA,CAAA;AACxB,IAAM,MAAA,EAAA,GAAK,aAAa,YAAY,CAAA,CAAA;AACpC,IAAA,MAAM,EAAE,SAAW,EAAA,QAAA,EAAU,WAAa,EAAA,WAAA,KAAgB,aAAc,EAAA,CAAA;AACxE,IAAA,MAAM,YAAY,GAAqB,EAAA,CAAA;AACvC,IAAA,MAAM,aAAa,QAAS,CAAA,MAAM;AAElC,MAAA,IAAA,EAAA,CAAS;AACP,MAAU,OAAA,CAAA,EAAA,GAAA,SAAc,CAAA,KAAO,KAAA,IAAA,GAAA,EAAA,GAAA,WAAA,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,WAAA,CAAA,KAAA,CAAA;AAAA,KACjC,CAAA,CAAA;AAEA,IAAA,SAAS,eAAmC,EAAA;AAC1C,MAAM,SAAA,CAAA,KAAW,GAAC,GAAG,GAAA,CAAA,GAAA,GAAA,EAAA,CAAA;AACrB,KAAA;AACA,IAAA,SAAA,YAAkB,CAAA,GAAA,EAAA;AAAA,MACpB,GAAA,GAAA,IAAA,CAAA,KAAA,CAAA,CAAA,GAAA,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}

View File

@@ -0,0 +1,22 @@
import type { ExtractPropTypes, __ExtractPublicPropTypes } from 'vue';
import type Next from './next.vue';
export declare const paginationNextProps: {
readonly disabled: BooleanConstructor;
readonly currentPage: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 1, boolean>;
readonly pageCount: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 50, boolean>;
readonly nextText: {
readonly type: import("vue").PropType<string>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly nextIcon: {
readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => (string | import("vue").Component) & {}) | (() => string | import("vue").Component) | ((new (...args: any[]) => (string | import("vue").Component) & {}) | (() => string | import("vue").Component))[], unknown, unknown>>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
};
export type PaginationNextProps = ExtractPropTypes<typeof paginationNextProps>;
export type PaginationNextPropsPublic = __ExtractPublicPropTypes<typeof paginationNextProps>;
export type NextInstance = InstanceType<typeof Next> & unknown;

View File

@@ -0,0 +1,23 @@
import { buildProps } from '../../../../utils/vue/props/runtime.mjs';
import { iconPropType } from '../../../../utils/vue/icon.mjs';
const paginationNextProps = buildProps({
disabled: Boolean,
currentPage: {
type: Number,
default: 1
},
pageCount: {
type: Number,
default: 50
},
nextText: {
type: String
},
nextIcon: {
type: iconPropType
}
});
export { paginationNextProps };
//# sourceMappingURL=next.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"next.mjs","sources":["../../../../../../../packages/components/pagination/src/components/next.ts"],"sourcesContent":["import { buildProps, iconPropType } from '@element-plus/utils'\n\nimport type { ExtractPropTypes, __ExtractPublicPropTypes } from 'vue'\nimport type Next from './next.vue'\n\nexport const paginationNextProps = buildProps({\n disabled: Boolean,\n currentPage: {\n type: Number,\n default: 1,\n },\n pageCount: {\n type: Number,\n default: 50,\n },\n nextText: {\n type: String,\n },\n nextIcon: {\n type: iconPropType,\n },\n} as const)\n\nexport type PaginationNextProps = ExtractPropTypes<typeof paginationNextProps>\nexport type PaginationNextPropsPublic = __ExtractPublicPropTypes<\n typeof paginationNextProps\n>\n\nexport type NextInstance = InstanceType<typeof Next> & unknown\n"],"names":[],"mappings":";;;AACY,MAAC,mBAAmB,GAAG,UAAU,CAAC;AAC9C,EAAE,QAAQ,EAAE,OAAO;AACnB,EAAE,WAAW,EAAE;AACf,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,CAAC;AACd,GAAG;AACH,EAAE,SAAS,EAAE;AACb,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,QAAQ,EAAE;AACZ,IAAI,IAAI,EAAE,MAAM;AAChB,GAAG;AACH,EAAE,QAAQ,EAAE;AACZ,IAAI,IAAI,EAAE,YAAY;AACtB,GAAG;AACH,CAAC;;;;"}

View File

@@ -0,0 +1,42 @@
declare const _default: import("vue").DefineComponent<{
readonly disabled: BooleanConstructor;
readonly currentPage: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 1, boolean>;
readonly pageCount: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 50, boolean>;
readonly nextText: {
readonly type: import("vue").PropType<string>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly nextIcon: {
readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => (string | import("vue").Component) & {}) | (() => string | import("vue").Component) | ((new (...args: any[]) => (string | import("vue").Component) & {}) | (() => string | import("vue").Component))[], unknown, unknown>>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
click: (...args: any[]) => void;
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
readonly disabled: BooleanConstructor;
readonly currentPage: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 1, boolean>;
readonly pageCount: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 50, boolean>;
readonly nextText: {
readonly type: import("vue").PropType<string>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly nextIcon: {
readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => (string | import("vue").Component) & {}) | (() => string | import("vue").Component) | ((new (...args: any[]) => (string | import("vue").Component) & {}) | (() => string | import("vue").Component))[], unknown, unknown>>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
}>> & {
onClick?: ((...args: any[]) => any) | undefined;
}, {
readonly disabled: boolean;
readonly currentPage: number;
readonly pageCount: number;
}>;
export default _default;

View File

@@ -0,0 +1,40 @@
import { defineComponent, computed, openBlock, createElementBlock, unref, toDisplayString, createBlock, withCtx, resolveDynamicComponent } from 'vue';
import { ElIcon } from '../../../icon/index.mjs';
import { paginationNextProps } from './next.mjs';
import _export_sfc from '../../../../_virtual/plugin-vue_export-helper.mjs';
import { useLocale } from '../../../../hooks/use-locale/index.mjs';
const __default__ = defineComponent({
name: "ElPaginationNext"
});
const _sfc_main = /* @__PURE__ */ defineComponent({
...__default__,
props: paginationNextProps,
emits: ["click"],
setup(__props) {
const props = __props;
const { t } = useLocale();
const internalDisabled = computed(() => props.disabled || props.currentPage === props.pageCount || props.pageCount === 0);
return (_ctx, _cache) => {
return openBlock(), createElementBlock("button", {
type: "button",
class: "btn-next",
disabled: unref(internalDisabled),
"aria-label": _ctx.nextText || unref(t)("el.pagination.next"),
"aria-disabled": unref(internalDisabled),
onClick: ($event) => _ctx.$emit("click", $event)
}, [
_ctx.nextText ? (openBlock(), createElementBlock("span", { key: 0 }, toDisplayString(_ctx.nextText), 1)) : (openBlock(), createBlock(unref(ElIcon), { key: 1 }, {
default: withCtx(() => [
(openBlock(), createBlock(resolveDynamicComponent(_ctx.nextIcon)))
]),
_: 1
}))
], 8, ["disabled", "aria-label", "aria-disabled", "onClick"]);
};
}
});
var Next = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "next.vue"]]);
export { Next as default };
//# sourceMappingURL=next2.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"next2.mjs","sources":["../../../../../../../packages/components/pagination/src/components/next.vue"],"sourcesContent":["<template>\n <button\n type=\"button\"\n class=\"btn-next\"\n :disabled=\"internalDisabled\"\n :aria-label=\"nextText || t('el.pagination.next')\"\n :aria-disabled=\"internalDisabled\"\n @click=\"$emit('click', $event)\"\n >\n <span v-if=\"nextText\">{{ nextText }}</span>\n <el-icon v-else>\n <component :is=\"nextIcon\" />\n </el-icon>\n </button>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed } from 'vue'\nimport { useLocale } from '@element-plus/hooks'\nimport { ElIcon } from '@element-plus/components/icon'\nimport { paginationNextProps } from './next'\n\ndefineOptions({\n name: 'ElPaginationNext',\n})\n\nconst props = defineProps(paginationNextProps)\n\ndefineEmits(['click'])\n\nconst { t } = useLocale()\n\nconst internalDisabled = computed(\n () =>\n props.disabled ||\n props.currentPage === props.pageCount ||\n props.pageCount === 0\n)\n</script>\n"],"names":["_openBlock","_createElementBlock"],"mappings":";;;;;;mCAsBc,CAAA;AAAA,EACZ,IAAM,EAAA,kBAAA;AACR,CAAA,CAAA,CAAA;;;;;;;AAMA,IAAM,MAAA,EAAE,CAAE,EAAA,GAAI,SAAU,EAAA,CAAA;AAExB,IAAA,MAAM,gBAAmB,GAAA,QAAA,CAAA,MAAA,KAAA,CAAA,QAAA,IAAA,KAAA,CAAA,WAAA,KAAA,KAAA,CAAA,SAAA,IAAA,KAAA,CAAA,SAAA,KAAA,CAAA,CAAA,CAAA;AAAA,IACvB,OAAA,CACE,MAAM,MACN,KAAA;AACoB,MACxB,OAAAA,SAAA,EAAA,EAAAC,kBAAA,CAAA,QAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;"}

View File

@@ -0,0 +1,16 @@
import type { ExtractPropTypes, __ExtractPublicPropTypes } from 'vue';
import type Pager from './pager.vue';
export declare const paginationPagerProps: {
readonly currentPage: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 1, boolean>;
readonly pageCount: {
readonly type: import("vue").PropType<number>;
readonly required: true;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly pagerCount: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 7, boolean>;
readonly disabled: BooleanConstructor;
};
export type PaginationPagerProps = ExtractPropTypes<typeof paginationPagerProps>;
export type PaginationPagerPropsPublic = __ExtractPublicPropTypes<typeof paginationPagerProps>;
export type PagerInstance = InstanceType<typeof Pager> & unknown;

View File

@@ -0,0 +1,20 @@
import { buildProps } from '../../../../utils/vue/props/runtime.mjs';
const paginationPagerProps = buildProps({
currentPage: {
type: Number,
default: 1
},
pageCount: {
type: Number,
required: true
},
pagerCount: {
type: Number,
default: 7
},
disabled: Boolean
});
export { paginationPagerProps };
//# sourceMappingURL=pager.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"pager.mjs","sources":["../../../../../../../packages/components/pagination/src/components/pager.ts"],"sourcesContent":["import { buildProps } from '@element-plus/utils'\n\nimport type { ExtractPropTypes, __ExtractPublicPropTypes } from 'vue'\nimport type Pager from './pager.vue'\n\nexport const paginationPagerProps = buildProps({\n currentPage: {\n type: Number,\n default: 1,\n },\n pageCount: {\n type: Number,\n required: true,\n },\n pagerCount: {\n type: Number,\n default: 7,\n },\n disabled: Boolean,\n} as const)\n\nexport type PaginationPagerProps = ExtractPropTypes<typeof paginationPagerProps>\nexport type PaginationPagerPropsPublic = __ExtractPublicPropTypes<\n typeof paginationPagerProps\n>\n\nexport type PagerInstance = InstanceType<typeof Pager> & unknown\n"],"names":[],"mappings":";;AACY,MAAC,oBAAoB,GAAG,UAAU,CAAC;AAC/C,EAAE,WAAW,EAAE;AACf,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,CAAC;AACd,GAAG;AACH,EAAE,SAAS,EAAE;AACb,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,QAAQ,EAAE,IAAI;AAClB,GAAG;AACH,EAAE,UAAU,EAAE;AACd,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,CAAC;AACd,GAAG;AACH,EAAE,QAAQ,EAAE,OAAO;AACnB,CAAC;;;;"}

View File

@@ -0,0 +1,30 @@
declare const _default: import("vue").DefineComponent<{
readonly currentPage: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 1, boolean>;
readonly pageCount: {
readonly type: import("vue").PropType<number>;
readonly required: true;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly pagerCount: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 7, boolean>;
readonly disabled: BooleanConstructor;
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
change: (...args: any[]) => void;
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
readonly currentPage: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 1, boolean>;
readonly pageCount: {
readonly type: import("vue").PropType<number>;
readonly required: true;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly pagerCount: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 7, boolean>;
readonly disabled: BooleanConstructor;
}>> & {
onChange?: ((...args: any[]) => any) | undefined;
}, {
readonly disabled: boolean;
readonly currentPage: number;
readonly pagerCount: number;
}>;
export default _default;

View File

@@ -0,0 +1,214 @@
import { defineComponent, ref, computed, watch, openBlock, createElementBlock, normalizeClass, unref, withKeys, createCommentVNode, createBlock, Fragment, renderList, toDisplayString } from 'vue';
import { DArrowLeft, MoreFilled, DArrowRight } from '@element-plus/icons-vue';
import { paginationPagerProps } from './pager.mjs';
import _export_sfc from '../../../../_virtual/plugin-vue_export-helper.mjs';
import { CHANGE_EVENT } from '../../../../constants/event.mjs';
import { useNamespace } from '../../../../hooks/use-namespace/index.mjs';
import { useLocale } from '../../../../hooks/use-locale/index.mjs';
const __default__ = defineComponent({
name: "ElPaginationPager"
});
const _sfc_main = /* @__PURE__ */ defineComponent({
...__default__,
props: paginationPagerProps,
emits: [CHANGE_EVENT],
setup(__props, { emit }) {
const props = __props;
const nsPager = useNamespace("pager");
const nsIcon = useNamespace("icon");
const { t } = useLocale();
const showPrevMore = ref(false);
const showNextMore = ref(false);
const quickPrevHover = ref(false);
const quickNextHover = ref(false);
const quickPrevFocus = ref(false);
const quickNextFocus = ref(false);
const pagers = computed(() => {
const pagerCount = props.pagerCount;
const halfPagerCount = (pagerCount - 1) / 2;
const currentPage = Number(props.currentPage);
const pageCount = Number(props.pageCount);
let showPrevMore2 = false;
let showNextMore2 = false;
if (pageCount > pagerCount) {
if (currentPage > pagerCount - halfPagerCount) {
showPrevMore2 = true;
}
if (currentPage < pageCount - halfPagerCount) {
showNextMore2 = true;
}
}
const array = [];
if (showPrevMore2 && !showNextMore2) {
const startPage = pageCount - (pagerCount - 2);
for (let i = startPage; i < pageCount; i++) {
array.push(i);
}
} else if (!showPrevMore2 && showNextMore2) {
for (let i = 2; i < pagerCount; i++) {
array.push(i);
}
} else if (showPrevMore2 && showNextMore2) {
const offset = Math.floor(pagerCount / 2) - 1;
for (let i = currentPage - offset; i <= currentPage + offset; i++) {
array.push(i);
}
} else {
for (let i = 2; i < pageCount; i++) {
array.push(i);
}
}
return array;
});
const prevMoreKls = computed(() => [
"more",
"btn-quickprev",
nsIcon.b(),
nsPager.is("disabled", props.disabled)
]);
const nextMoreKls = computed(() => [
"more",
"btn-quicknext",
nsIcon.b(),
nsPager.is("disabled", props.disabled)
]);
const tabindex = computed(() => props.disabled ? -1 : 0);
watch(() => [props.pageCount, props.pagerCount, props.currentPage], ([pageCount, pagerCount, currentPage]) => {
const halfPagerCount = (pagerCount - 1) / 2;
let showPrev = false;
let showNext = false;
if (pageCount > pagerCount) {
showPrev = currentPage > pagerCount - halfPagerCount;
showNext = currentPage < pageCount - halfPagerCount;
}
quickPrevHover.value && (quickPrevHover.value = showPrev);
quickNextHover.value && (quickNextHover.value = showNext);
showPrevMore.value = showPrev;
showNextMore.value = showNext;
}, { immediate: true });
function onMouseEnter(forward = false) {
if (props.disabled)
return;
if (forward) {
quickPrevHover.value = true;
} else {
quickNextHover.value = true;
}
}
function onFocus(forward = false) {
if (forward) {
quickPrevFocus.value = true;
} else {
quickNextFocus.value = true;
}
}
function onEnter(e) {
const target = e.target;
if (target.tagName.toLowerCase() === "li" && Array.from(target.classList).includes("number")) {
const newPage = Number(target.textContent);
if (newPage !== props.currentPage) {
emit(CHANGE_EVENT, newPage);
}
} else if (target.tagName.toLowerCase() === "li" && Array.from(target.classList).includes("more")) {
onPagerClick(e);
}
}
function onPagerClick(event) {
const target = event.target;
if (target.tagName.toLowerCase() === "ul" || props.disabled) {
return;
}
let newPage = Number(target.textContent);
const pageCount = props.pageCount;
const currentPage = props.currentPage;
const pagerCountOffset = props.pagerCount - 2;
if (target.className.includes("more")) {
if (target.className.includes("quickprev")) {
newPage = currentPage - pagerCountOffset;
} else if (target.className.includes("quicknext")) {
newPage = currentPage + pagerCountOffset;
}
}
if (!Number.isNaN(+newPage)) {
if (newPage < 1) {
newPage = 1;
}
if (newPage > pageCount) {
newPage = pageCount;
}
}
if (newPage !== currentPage) {
emit(CHANGE_EVENT, newPage);
}
}
return (_ctx, _cache) => {
return openBlock(), createElementBlock("ul", {
class: normalizeClass(unref(nsPager).b()),
onClick: onPagerClick,
onKeyup: withKeys(onEnter, ["enter"])
}, [
_ctx.pageCount > 0 ? (openBlock(), createElementBlock("li", {
key: 0,
class: normalizeClass([[
unref(nsPager).is("active", _ctx.currentPage === 1),
unref(nsPager).is("disabled", _ctx.disabled)
], "number"]),
"aria-current": _ctx.currentPage === 1,
"aria-label": unref(t)("el.pagination.currentPage", { pager: 1 }),
tabindex: unref(tabindex)
}, " 1 ", 10, ["aria-current", "aria-label", "tabindex"])) : createCommentVNode("v-if", true),
showPrevMore.value ? (openBlock(), createElementBlock("li", {
key: 1,
class: normalizeClass(unref(prevMoreKls)),
tabindex: unref(tabindex),
"aria-label": unref(t)("el.pagination.prevPages", { pager: _ctx.pagerCount - 2 }),
onMouseenter: ($event) => onMouseEnter(true),
onMouseleave: ($event) => quickPrevHover.value = false,
onFocus: ($event) => onFocus(true),
onBlur: ($event) => quickPrevFocus.value = false
}, [
(quickPrevHover.value || quickPrevFocus.value) && !_ctx.disabled ? (openBlock(), createBlock(unref(DArrowLeft), { key: 0 })) : (openBlock(), createBlock(unref(MoreFilled), { key: 1 }))
], 42, ["tabindex", "aria-label", "onMouseenter", "onMouseleave", "onFocus", "onBlur"])) : createCommentVNode("v-if", true),
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(pagers), (pager) => {
return openBlock(), createElementBlock("li", {
key: pager,
class: normalizeClass([[
unref(nsPager).is("active", _ctx.currentPage === pager),
unref(nsPager).is("disabled", _ctx.disabled)
], "number"]),
"aria-current": _ctx.currentPage === pager,
"aria-label": unref(t)("el.pagination.currentPage", { pager }),
tabindex: unref(tabindex)
}, toDisplayString(pager), 11, ["aria-current", "aria-label", "tabindex"]);
}), 128)),
showNextMore.value ? (openBlock(), createElementBlock("li", {
key: 2,
class: normalizeClass(unref(nextMoreKls)),
tabindex: unref(tabindex),
"aria-label": unref(t)("el.pagination.nextPages", { pager: _ctx.pagerCount - 2 }),
onMouseenter: ($event) => onMouseEnter(),
onMouseleave: ($event) => quickNextHover.value = false,
onFocus: ($event) => onFocus(),
onBlur: ($event) => quickNextFocus.value = false
}, [
(quickNextHover.value || quickNextFocus.value) && !_ctx.disabled ? (openBlock(), createBlock(unref(DArrowRight), { key: 0 })) : (openBlock(), createBlock(unref(MoreFilled), { key: 1 }))
], 42, ["tabindex", "aria-label", "onMouseenter", "onMouseleave", "onFocus", "onBlur"])) : createCommentVNode("v-if", true),
_ctx.pageCount > 1 ? (openBlock(), createElementBlock("li", {
key: 3,
class: normalizeClass([[
unref(nsPager).is("active", _ctx.currentPage === _ctx.pageCount),
unref(nsPager).is("disabled", _ctx.disabled)
], "number"]),
"aria-current": _ctx.currentPage === _ctx.pageCount,
"aria-label": unref(t)("el.pagination.currentPage", { pager: _ctx.pageCount }),
tabindex: unref(tabindex)
}, toDisplayString(_ctx.pageCount), 11, ["aria-current", "aria-label", "tabindex"])) : createCommentVNode("v-if", true)
], 42, ["onKeyup"]);
};
}
});
var Pager = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "pager.vue"]]);
export { Pager as default };
//# sourceMappingURL=pager2.mjs.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,24 @@
import type { ExtractPropTypes, __ExtractPublicPropTypes } from 'vue';
import type Prev from './prev.vue';
export declare const paginationPrevProps: {
readonly disabled: BooleanConstructor;
readonly currentPage: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 1, boolean>;
readonly prevText: {
readonly type: import("vue").PropType<string>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly prevIcon: {
readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => (string | import("vue").Component) & {}) | (() => string | import("vue").Component) | ((new (...args: any[]) => (string | import("vue").Component) & {}) | (() => string | import("vue").Component))[], unknown, unknown>>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
};
export declare const paginationPrevEmits: {
click: (evt: MouseEvent) => boolean;
};
export type PaginationPrevProps = ExtractPropTypes<typeof paginationPrevProps>;
export type PaginationPrevPropsPublic = __ExtractPublicPropTypes<typeof paginationPrevProps>;
export type PrevInstance = InstanceType<typeof Prev> & unknown;

View File

@@ -0,0 +1,22 @@
import { buildProps } from '../../../../utils/vue/props/runtime.mjs';
import { iconPropType } from '../../../../utils/vue/icon.mjs';
const paginationPrevProps = buildProps({
disabled: Boolean,
currentPage: {
type: Number,
default: 1
},
prevText: {
type: String
},
prevIcon: {
type: iconPropType
}
});
const paginationPrevEmits = {
click: (evt) => evt instanceof MouseEvent
};
export { paginationPrevEmits, paginationPrevProps };
//# sourceMappingURL=prev.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"prev.mjs","sources":["../../../../../../../packages/components/pagination/src/components/prev.ts"],"sourcesContent":["import { buildProps, iconPropType } from '@element-plus/utils'\n\nimport type { ExtractPropTypes, __ExtractPublicPropTypes } from 'vue'\nimport type Prev from './prev.vue'\n\nexport const paginationPrevProps = buildProps({\n disabled: Boolean,\n currentPage: {\n type: Number,\n default: 1,\n },\n prevText: {\n type: String,\n },\n prevIcon: {\n type: iconPropType,\n },\n} as const)\n\nexport const paginationPrevEmits = {\n click: (evt: MouseEvent) => evt instanceof MouseEvent,\n}\n\nexport type PaginationPrevProps = ExtractPropTypes<typeof paginationPrevProps>\nexport type PaginationPrevPropsPublic = __ExtractPublicPropTypes<\n typeof paginationPrevProps\n>\n\nexport type PrevInstance = InstanceType<typeof Prev> & unknown\n"],"names":[],"mappings":";;;AACY,MAAC,mBAAmB,GAAG,UAAU,CAAC;AAC9C,EAAE,QAAQ,EAAE,OAAO;AACnB,EAAE,WAAW,EAAE;AACf,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,CAAC;AACd,GAAG;AACH,EAAE,QAAQ,EAAE;AACZ,IAAI,IAAI,EAAE,MAAM;AAChB,GAAG;AACH,EAAE,QAAQ,EAAE;AACZ,IAAI,IAAI,EAAE,YAAY;AACtB,GAAG;AACH,CAAC,EAAE;AACS,MAAC,mBAAmB,GAAG;AACnC,EAAE,KAAK,EAAE,CAAC,GAAG,KAAK,GAAG,YAAY,UAAU;AAC3C;;;;"}

View File

@@ -0,0 +1,39 @@
declare const _default: import("vue").DefineComponent<{
readonly disabled: BooleanConstructor;
readonly currentPage: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 1, boolean>;
readonly prevText: {
readonly type: import("vue").PropType<string>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly prevIcon: {
readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => (string | import("vue").Component) & {}) | (() => string | import("vue").Component) | ((new (...args: any[]) => (string | import("vue").Component) & {}) | (() => string | import("vue").Component))[], unknown, unknown>>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
click: (evt: MouseEvent) => void;
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
readonly disabled: BooleanConstructor;
readonly currentPage: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 1, boolean>;
readonly prevText: {
readonly type: import("vue").PropType<string>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly prevIcon: {
readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => (string | import("vue").Component) & {}) | (() => string | import("vue").Component) | ((new (...args: any[]) => (string | import("vue").Component) & {}) | (() => string | import("vue").Component))[], unknown, unknown>>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
}>> & {
onClick?: ((evt: MouseEvent) => any) | undefined;
}, {
readonly disabled: boolean;
readonly currentPage: number;
}>;
export default _default;

View File

@@ -0,0 +1,40 @@
import { defineComponent, computed, openBlock, createElementBlock, unref, toDisplayString, createBlock, withCtx, resolveDynamicComponent } from 'vue';
import { ElIcon } from '../../../icon/index.mjs';
import { paginationPrevProps, paginationPrevEmits } from './prev.mjs';
import _export_sfc from '../../../../_virtual/plugin-vue_export-helper.mjs';
import { useLocale } from '../../../../hooks/use-locale/index.mjs';
const __default__ = defineComponent({
name: "ElPaginationPrev"
});
const _sfc_main = /* @__PURE__ */ defineComponent({
...__default__,
props: paginationPrevProps,
emits: paginationPrevEmits,
setup(__props) {
const props = __props;
const { t } = useLocale();
const internalDisabled = computed(() => props.disabled || props.currentPage <= 1);
return (_ctx, _cache) => {
return openBlock(), createElementBlock("button", {
type: "button",
class: "btn-prev",
disabled: unref(internalDisabled),
"aria-label": _ctx.prevText || unref(t)("el.pagination.prev"),
"aria-disabled": unref(internalDisabled),
onClick: ($event) => _ctx.$emit("click", $event)
}, [
_ctx.prevText ? (openBlock(), createElementBlock("span", { key: 0 }, toDisplayString(_ctx.prevText), 1)) : (openBlock(), createBlock(unref(ElIcon), { key: 1 }, {
default: withCtx(() => [
(openBlock(), createBlock(resolveDynamicComponent(_ctx.prevIcon)))
]),
_: 1
}))
], 8, ["disabled", "aria-label", "aria-disabled", "onClick"]);
};
}
});
var Prev = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "prev.vue"]]);
export { Prev as default };
//# sourceMappingURL=prev2.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"prev2.mjs","sources":["../../../../../../../packages/components/pagination/src/components/prev.vue"],"sourcesContent":["<template>\n <button\n type=\"button\"\n class=\"btn-prev\"\n :disabled=\"internalDisabled\"\n :aria-label=\"prevText || t('el.pagination.prev')\"\n :aria-disabled=\"internalDisabled\"\n @click=\"$emit('click', $event)\"\n >\n <span v-if=\"prevText\">{{ prevText }}</span>\n <el-icon v-else>\n <component :is=\"prevIcon\" />\n </el-icon>\n </button>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed } from 'vue'\nimport { useLocale } from '@element-plus/hooks'\nimport { ElIcon } from '@element-plus/components/icon'\nimport { paginationPrevEmits, paginationPrevProps } from './prev'\n\ndefineOptions({\n name: 'ElPaginationPrev',\n})\n\nconst props = defineProps(paginationPrevProps)\ndefineEmits(paginationPrevEmits)\n\nconst { t } = useLocale()\n\nconst internalDisabled = computed(\n () => props.disabled || props.currentPage <= 1\n)\n</script>\n"],"names":["_openBlock","_createElementBlock"],"mappings":";;;;;;mCAsBc,CAAA;AAAA,EACZ,IAAM,EAAA,kBAAA;AACR,CAAA,CAAA,CAAA;;;;;;;AAKA,IAAM,MAAA,EAAE,CAAE,EAAA,GAAI,SAAU,EAAA,CAAA;AAExB,IAAA,MAAM,gBAAmB,GAAA,QAAA,CAAA,MAAA,KAAA,CAAA,QAAA,IAAA,KAAA,CAAA,WAAA,IAAA,CAAA,CAAA,CAAA;AAAA,IAAA,OACjB,CAAA,IAAA,EAAM,MAAY,KAAA;AAAqB,MAC/C,OAAAA,SAAA,EAAA,EAAAC,kBAAA,CAAA,QAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;"}

View File

@@ -0,0 +1,29 @@
import type { ExtractPropTypes, __ExtractPublicPropTypes } from 'vue';
import type Sizes from './sizes.vue';
export declare const paginationSizesProps: {
readonly pageSize: {
readonly type: import("vue").PropType<number>;
readonly required: true;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly pageSizes: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => number[]) | (() => number[]) | ((new (...args: any[]) => number[]) | (() => number[]))[], unknown, unknown, () => [10, 20, 30, 40, 50, 100], boolean>;
readonly popperClass: {
readonly type: import("vue").PropType<string>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly disabled: BooleanConstructor;
readonly teleported: BooleanConstructor;
readonly size: {
readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<StringConstructor, "" | "small" | "default" | "large", unknown>>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly appendSizeTo: StringConstructor;
};
export type PaginationSizesProps = ExtractPropTypes<typeof paginationSizesProps>;
export type PaginationSizesPropsPublic = __ExtractPublicPropTypes<typeof paginationSizesProps>;
export type SizesInstance = InstanceType<typeof Sizes> & unknown;

View File

@@ -0,0 +1,75 @@
import { defineComponent, ref, watch, computed, openBlock, createElementBlock, normalizeClass, unref, createVNode, withCtx, Fragment, renderList, createBlock } from 'vue';
import { isEqual } from 'lodash-unified';
import { ElSelect, ElOption } from '../../../select/index.mjs';
import { usePagination } from '../usePagination.mjs';
import { paginationSizesProps } from './sizes2.mjs';
import _export_sfc from '../../../../_virtual/plugin-vue_export-helper.mjs';
import { useLocale } from '../../../../hooks/use-locale/index.mjs';
import { useNamespace } from '../../../../hooks/use-namespace/index.mjs';
import { isArray } from '@vue/shared';
const __default__ = defineComponent({
name: "ElPaginationSizes"
});
const _sfc_main = /* @__PURE__ */ defineComponent({
...__default__,
props: paginationSizesProps,
emits: ["page-size-change"],
setup(__props, { emit }) {
const props = __props;
const { t } = useLocale();
const ns = useNamespace("pagination");
const pagination = usePagination();
const innerPageSize = ref(props.pageSize);
watch(() => props.pageSizes, (newVal, oldVal) => {
if (isEqual(newVal, oldVal))
return;
if (isArray(newVal)) {
const pageSize = newVal.includes(props.pageSize) ? props.pageSize : props.pageSizes[0];
emit("page-size-change", pageSize);
}
});
watch(() => props.pageSize, (newVal) => {
innerPageSize.value = newVal;
});
const innerPageSizes = computed(() => props.pageSizes);
function handleChange(val) {
var _a;
if (val !== innerPageSize.value) {
innerPageSize.value = val;
(_a = pagination.handleSizeChange) == null ? void 0 : _a.call(pagination, Number(val));
}
}
return (_ctx, _cache) => {
return openBlock(), createElementBlock("span", {
class: normalizeClass(unref(ns).e("sizes"))
}, [
createVNode(unref(ElSelect), {
"model-value": innerPageSize.value,
disabled: _ctx.disabled,
"popper-class": _ctx.popperClass,
size: _ctx.size,
teleported: _ctx.teleported,
"validate-event": false,
"append-to": _ctx.appendSizeTo,
onChange: handleChange
}, {
default: withCtx(() => [
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(innerPageSizes), (item) => {
return openBlock(), createBlock(unref(ElOption), {
key: item,
value: item,
label: item + unref(t)("el.pagination.pagesize")
}, null, 8, ["value", "label"]);
}), 128))
]),
_: 1
}, 8, ["model-value", "disabled", "popper-class", "size", "teleported", "append-to"])
], 2);
};
}
});
var Sizes = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "sizes.vue"]]);
export { Sizes as default };
//# sourceMappingURL=sizes.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"sizes.mjs","sources":["../../../../../../../packages/components/pagination/src/components/sizes.vue"],"sourcesContent":["<template>\n <span :class=\"ns.e('sizes')\">\n <el-select\n :model-value=\"innerPageSize\"\n :disabled=\"disabled\"\n :popper-class=\"popperClass\"\n :size=\"size\"\n :teleported=\"teleported\"\n :validate-event=\"false\"\n :append-to=\"appendSizeTo\"\n @change=\"handleChange\"\n >\n <el-option\n v-for=\"item in innerPageSizes\"\n :key=\"item\"\n :value=\"item\"\n :label=\"item + t('el.pagination.pagesize')\"\n />\n </el-select>\n </span>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed, ref, watch } from 'vue'\nimport { isEqual } from 'lodash-unified'\nimport { ElOption, ElSelect } from '@element-plus/components/select'\nimport { useLocale, useNamespace } from '@element-plus/hooks'\nimport { isArray } from '@element-plus/utils'\nimport { usePagination } from '../usePagination'\nimport { paginationSizesProps } from './sizes'\n\ndefineOptions({\n name: 'ElPaginationSizes',\n})\n\nconst props = defineProps(paginationSizesProps)\nconst emit = defineEmits(['page-size-change'])\nconst { t } = useLocale()\nconst ns = useNamespace('pagination')\nconst pagination = usePagination()\nconst innerPageSize = ref<number>(props.pageSize!)\n\nwatch(\n () => props.pageSizes,\n (newVal, oldVal) => {\n if (isEqual(newVal, oldVal)) return\n if (isArray(newVal)) {\n const pageSize = newVal.includes(props.pageSize!)\n ? props.pageSize\n : props.pageSizes[0]\n emit('page-size-change', pageSize)\n }\n }\n)\n\nwatch(\n () => props.pageSize,\n (newVal) => {\n innerPageSize.value = newVal!\n }\n)\n\nconst innerPageSizes = computed(() => props.pageSizes)\nfunction handleChange(val: number) {\n if (val !== innerPageSize.value) {\n innerPageSize.value = val\n pagination.handleSizeChange?.(Number(val))\n }\n}\n</script>\n"],"names":["_openBlock","_createElementBlock","_normalizeClass","_unref"],"mappings":";;;;;;;;;;mCA+Bc,CAAA;AAAA,EACZ,IAAM,EAAA,mBAAA;AACR,CAAA,CAAA,CAAA;;;;;;;AAIA,IAAM,MAAA,EAAE,CAAE,EAAA,GAAI,SAAU,EAAA,CAAA;AACxB,IAAM,MAAA,EAAA,GAAK,aAAa,YAAY,CAAA,CAAA;AACpC,IAAA,MAAM,aAAa,aAAc,EAAA,CAAA;AACjC,IAAM,MAAA,aAAA,GAAgB,GAAY,CAAA,KAAA,CAAM,QAAS,CAAA,CAAA;AAEjD,IAAA,KAAA,CAAA,MAAA,KAAA,CAAA,SAAA,EAAA,CAAA,MAAA,EAAA,MAAA,KAAA;AAAA,MACE,WAAY,CAAA,MAAA,EAAA,MAAA,CAAA;AAAA,eACH;AACP,MAAI,IAAA,OAAA,CAAA,MAAgB,CAAA,EAAA;AACpB,QAAI,MAAA,iBAAiB,CAAA,QAAA,CAAA,KAAA,CAAA,QAAA,CAAA,GAAA,KAAA,CAAA,QAAA,GAAA,KAAA,CAAA,SAAA,CAAA,CAAA,CAAA,CAAA;AACnB,QAAM,IAAA,CAAA,kBAAkB,EAAA,QAAA,CAAA,CAAS;AAGjC,OAAA;AAAiC,KACnC,CAAA,CAAA;AAAA,IACF,KAAA,CAAA,MAAA,KAAA,CAAA,QAAA,EAAA,CAAA,MAAA,KAAA;AAAA,MACF,aAAA,CAAA,KAAA,GAAA,MAAA,CAAA;AAEA,KAAA,CAAA,CAAA;AAAA,IAAA,oBACc,GAAA,QAAA,CAAA,MAAA,KAAA,CAAA,SAAA,CAAA,CAAA;AAAA,IAAA,SACA,YAAA,CAAA,GAAA,EAAA;AACV,MAAA,IAAA,EAAA,CAAA;AAAsB,MACxB,IAAA,GAAA,KAAA,aAAA,CAAA,KAAA,EAAA;AAAA,QACF,aAAA,CAAA,KAAA,GAAA,GAAA,CAAA;AAEA,QAAA,CAAA,EAAuB,GAAA,UAAA,CAAA,gBAAe,KAAA,IAAe,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,IAAA,CAAA,UAAA,EAAA,MAAA,CAAA,GAAA,CAAA,CAAA,CAAA;AACrD,OAAA;AACE,KAAI;AACF,IAAA,OAAA,CAAA,IAAA,EAAA,MAAsB,KAAA;AACtB,MAAW,OAAAA,SAAA,EAAA,EAAAC,kBAA0B,CAAA,MAAI,EAAA;AAAA,QAC3C,KAAA,EAAAC,cAAA,CAAAC,KAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,OAAA,CAAA,CAAA;AAAA,OACF,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}

View File

@@ -0,0 +1,56 @@
declare const _default: import("vue").DefineComponent<{
readonly pageSize: {
readonly type: import("vue").PropType<number>;
readonly required: true;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly pageSizes: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => number[]) | (() => number[]) | ((new (...args: any[]) => number[]) | (() => number[]))[], unknown, unknown, () => [10, 20, 30, 40, 50, 100], boolean>;
readonly popperClass: {
readonly type: import("vue").PropType<string>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly disabled: BooleanConstructor;
readonly teleported: BooleanConstructor;
readonly size: {
readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<StringConstructor, "" | "small" | "default" | "large", unknown>>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly appendSizeTo: StringConstructor;
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
"page-size-change": (...args: any[]) => void;
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
readonly pageSize: {
readonly type: import("vue").PropType<number>;
readonly required: true;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly pageSizes: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => number[]) | (() => number[]) | ((new (...args: any[]) => number[]) | (() => number[]))[], unknown, unknown, () => [10, 20, 30, 40, 50, 100], boolean>;
readonly popperClass: {
readonly type: import("vue").PropType<string>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly disabled: BooleanConstructor;
readonly teleported: BooleanConstructor;
readonly size: {
readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<StringConstructor, "" | "small" | "default" | "large", unknown>>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly appendSizeTo: StringConstructor;
}>> & {
"onPage-size-change"?: ((...args: any[]) => any) | undefined;
}, {
readonly disabled: boolean;
readonly teleported: boolean;
readonly pageSizes: number[];
}>;
export default _default;

View File

@@ -0,0 +1,27 @@
import { buildProps, definePropType } from '../../../../utils/vue/props/runtime.mjs';
import { mutable } from '../../../../utils/typescript.mjs';
import { componentSizes } from '../../../../constants/size.mjs';
const paginationSizesProps = buildProps({
pageSize: {
type: Number,
required: true
},
pageSizes: {
type: definePropType(Array),
default: () => mutable([10, 20, 30, 40, 50, 100])
},
popperClass: {
type: String
},
disabled: Boolean,
teleported: Boolean,
size: {
type: String,
values: componentSizes
},
appendSizeTo: String
});
export { paginationSizesProps };
//# sourceMappingURL=sizes2.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"sizes2.mjs","sources":["../../../../../../../packages/components/pagination/src/components/sizes.ts"],"sourcesContent":["import { buildProps, definePropType, mutable } from '@element-plus/utils'\nimport { componentSizes } from '@element-plus/constants'\n\nimport type { ExtractPropTypes, __ExtractPublicPropTypes } from 'vue'\nimport type Sizes from './sizes.vue'\n\nexport const paginationSizesProps = buildProps({\n pageSize: {\n type: Number,\n required: true,\n },\n pageSizes: {\n type: definePropType<number[]>(Array),\n default: () => mutable([10, 20, 30, 40, 50, 100] as const),\n },\n popperClass: {\n type: String,\n },\n disabled: Boolean,\n teleported: Boolean,\n size: {\n type: String,\n values: componentSizes,\n },\n appendSizeTo: String,\n} as const)\n\nexport type PaginationSizesProps = ExtractPropTypes<typeof paginationSizesProps>\nexport type PaginationSizesPropsPublic = __ExtractPublicPropTypes<\n typeof paginationSizesProps\n>\n\nexport type SizesInstance = InstanceType<typeof Sizes> & unknown\n"],"names":[],"mappings":";;;;AAEY,MAAC,oBAAoB,GAAG,UAAU,CAAC;AAC/C,EAAE,QAAQ,EAAE;AACZ,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,QAAQ,EAAE,IAAI;AAClB,GAAG;AACH,EAAE,SAAS,EAAE;AACb,IAAI,IAAI,EAAE,cAAc,CAAC,KAAK,CAAC;AAC/B,IAAI,OAAO,EAAE,MAAM,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,CAAC,CAAC;AACrD,GAAG;AACH,EAAE,WAAW,EAAE;AACf,IAAI,IAAI,EAAE,MAAM;AAChB,GAAG;AACH,EAAE,QAAQ,EAAE,OAAO;AACnB,EAAE,UAAU,EAAE,OAAO;AACrB,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,MAAM,EAAE,cAAc;AAC1B,GAAG;AACH,EAAE,YAAY,EAAE,MAAM;AACtB,CAAC;;;;"}

View File

@@ -0,0 +1,8 @@
import type Total from './total.vue';
import type { ExtractPropTypes, __ExtractPublicPropTypes } from 'vue';
export declare const paginationTotalProps: {
readonly total: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 1000, boolean>;
};
export type PaginationTotalProps = ExtractPropTypes<typeof paginationTotalProps>;
export type PaginationTotalPropsPublic = __ExtractPublicPropTypes<typeof paginationTotalProps>;
export type TotalInstance = InstanceType<typeof Total> & unknown;

View File

@@ -0,0 +1,11 @@
import { buildProps } from '../../../../utils/vue/props/runtime.mjs';
const paginationTotalProps = buildProps({
total: {
type: Number,
default: 1e3
}
});
export { paginationTotalProps };
//# sourceMappingURL=total.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"total.mjs","sources":["../../../../../../../packages/components/pagination/src/components/total.ts"],"sourcesContent":["import { buildProps } from '@element-plus/utils'\n\nimport type Total from './total.vue'\nimport type { ExtractPropTypes, __ExtractPublicPropTypes } from 'vue'\n\nexport const paginationTotalProps = buildProps({\n total: {\n type: Number,\n default: 1000,\n },\n} as const)\n\nexport type PaginationTotalProps = ExtractPropTypes<typeof paginationTotalProps>\nexport type PaginationTotalPropsPublic = __ExtractPublicPropTypes<\n typeof paginationTotalProps\n>\n\nexport type TotalInstance = InstanceType<typeof Total> & unknown\n"],"names":[],"mappings":";;AACY,MAAC,oBAAoB,GAAG,UAAU,CAAC;AAC/C,EAAE,KAAK,EAAE;AACT,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,GAAG;AAChB,GAAG;AACH,CAAC;;;;"}

View File

@@ -0,0 +1,8 @@
declare const _default: import("vue").DefineComponent<{
readonly total: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 1000, boolean>;
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
readonly total: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 1000, boolean>;
}>>, {
readonly total: number;
}>;
export default _default;

View File

@@ -0,0 +1,31 @@
import { defineComponent, openBlock, createElementBlock, normalizeClass, unref, toDisplayString } from 'vue';
import { usePagination } from '../usePagination.mjs';
import { paginationTotalProps } from './total.mjs';
import _export_sfc from '../../../../_virtual/plugin-vue_export-helper.mjs';
import { useLocale } from '../../../../hooks/use-locale/index.mjs';
import { useNamespace } from '../../../../hooks/use-namespace/index.mjs';
const __default__ = defineComponent({
name: "ElPaginationTotal"
});
const _sfc_main = /* @__PURE__ */ defineComponent({
...__default__,
props: paginationTotalProps,
setup(__props) {
const { t } = useLocale();
const ns = useNamespace("pagination");
const { disabled } = usePagination();
return (_ctx, _cache) => {
return openBlock(), createElementBlock("span", {
class: normalizeClass(unref(ns).e("total")),
disabled: unref(disabled)
}, toDisplayString(unref(t)("el.pagination.total", {
total: _ctx.total
})), 11, ["disabled"]);
};
}
});
var Total = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "total.vue"]]);
export { Total as default };
//# sourceMappingURL=total2.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"total2.mjs","sources":["../../../../../../../packages/components/pagination/src/components/total.vue"],"sourcesContent":["<template>\n <span :class=\"ns.e('total')\" :disabled=\"disabled\">\n {{\n t('el.pagination.total', {\n total,\n })\n }}\n </span>\n</template>\n\n<script lang=\"ts\" setup>\nimport { useLocale, useNamespace } from '@element-plus/hooks'\nimport { usePagination } from '../usePagination'\nimport { paginationTotalProps } from './total'\n\nconst { t } = useLocale()\nconst ns = useNamespace('pagination')\nconst { disabled } = usePagination()\n\ndefineOptions({\n name: 'ElPaginationTotal',\n})\n\ndefineProps(paginationTotalProps)\n</script>\n"],"names":[],"mappings":";;;;;;;mCAmBc,CAAA;AAAA,EACZ,IAAM,EAAA,mBAAA;AACR,CAAA,CAAA,CAAA;;;;;AANA,IAAM,MAAA,EAAE,CAAE,EAAA,GAAI,SAAU,EAAA,CAAA;AACxB,IAAM,MAAA,EAAA,GAAK,aAAa,YAAY,CAAA,CAAA;AACpC,IAAM,MAAA,EAAE,QAAS,EAAA,GAAI,aAAc,EAAA,CAAA;;;;;;;;;;;;;;;"}

View File

@@ -0,0 +1,9 @@
import type { ComputedRef, InjectionKey, WritableComputedRef } from 'vue';
export interface ElPaginationContext {
currentPage?: WritableComputedRef<number>;
pageCount?: ComputedRef<number>;
disabled?: ComputedRef<boolean>;
changeEvent?: (val: number) => void;
handleSizeChange?: (val: number) => void;
}
export declare const elPaginationKey: InjectionKey<ElPaginationContext>;

View File

@@ -0,0 +1,4 @@
const elPaginationKey = Symbol("elPaginationKey");
export { elPaginationKey };
//# sourceMappingURL=constants.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"constants.mjs","sources":["../../../../../../packages/components/pagination/src/constants.ts"],"sourcesContent":["import type { ComputedRef, InjectionKey, WritableComputedRef } from 'vue'\n\nexport interface ElPaginationContext {\n currentPage?: WritableComputedRef<number>\n pageCount?: ComputedRef<number>\n disabled?: ComputedRef<boolean>\n changeEvent?: (val: number) => void\n handleSizeChange?: (val: number) => void\n}\n\nexport const elPaginationKey: InjectionKey<ElPaginationContext> =\n Symbol('elPaginationKey')\n"],"names":[],"mappings":"AAAY,MAAC,eAAe,GAAG,MAAM,CAAC,iBAAiB;;;;"}

View File

@@ -0,0 +1,129 @@
import type { ExtractPropTypes, VNode, __ExtractPublicPropTypes } from 'vue';
export declare const paginationProps: {
readonly pageSize: NumberConstructor;
readonly defaultPageSize: NumberConstructor;
readonly total: NumberConstructor;
readonly pageCount: NumberConstructor;
readonly pagerCount: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 7, boolean>;
readonly currentPage: NumberConstructor;
readonly defaultCurrentPage: NumberConstructor;
readonly layout: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, string, boolean>;
readonly pageSizes: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => number[]) | (() => number[]) | ((new (...args: any[]) => number[]) | (() => number[]))[], unknown, unknown, () => [10, 20, 30, 40, 50, 100], boolean>;
readonly popperClass: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
readonly prevText: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
readonly prevIcon: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => (string | import("vue").Component) & {}) | (() => string | import("vue").Component) | ((new (...args: any[]) => (string | import("vue").Component) & {}) | (() => string | import("vue").Component))[], unknown, unknown, () => any, boolean>;
readonly nextText: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
readonly nextIcon: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => (string | import("vue").Component) & {}) | (() => string | import("vue").Component) | ((new (...args: any[]) => (string | import("vue").Component) & {}) | (() => string | import("vue").Component))[], unknown, unknown, () => any, boolean>;
readonly teleported: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
readonly small: BooleanConstructor;
readonly size: {
readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<StringConstructor, "" | "small" | "default" | "large", never>>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly background: BooleanConstructor;
readonly disabled: BooleanConstructor;
readonly hideOnSinglePage: BooleanConstructor;
readonly appendSizeTo: StringConstructor;
};
export type PaginationProps = ExtractPropTypes<typeof paginationProps>;
export type PaginationPropsPublic = __ExtractPublicPropTypes<typeof paginationProps>;
export declare const paginationEmits: {
'update:current-page': (val: number) => boolean;
'update:page-size': (val: number) => boolean;
'size-change': (val: number) => boolean;
change: (currentPage: number, pageSize: number) => boolean;
'current-change': (val: number) => boolean;
'prev-click': (val: number) => boolean;
'next-click': (val: number) => boolean;
};
export type PaginationEmits = typeof paginationEmits;
declare const _default: import("vue").DefineComponent<{
readonly pageSize: NumberConstructor;
readonly defaultPageSize: NumberConstructor;
readonly total: NumberConstructor;
readonly pageCount: NumberConstructor;
readonly pagerCount: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 7, boolean>;
readonly currentPage: NumberConstructor;
readonly defaultCurrentPage: NumberConstructor;
readonly layout: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, string, boolean>;
readonly pageSizes: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => number[]) | (() => number[]) | ((new (...args: any[]) => number[]) | (() => number[]))[], unknown, unknown, () => [10, 20, 30, 40, 50, 100], boolean>;
readonly popperClass: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
readonly prevText: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
readonly prevIcon: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => (string | import("vue").Component) & {}) | (() => string | import("vue").Component) | ((new (...args: any[]) => (string | import("vue").Component) & {}) | (() => string | import("vue").Component))[], unknown, unknown, () => any, boolean>;
readonly nextText: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
readonly nextIcon: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => (string | import("vue").Component) & {}) | (() => string | import("vue").Component) | ((new (...args: any[]) => (string | import("vue").Component) & {}) | (() => string | import("vue").Component))[], unknown, unknown, () => any, boolean>;
readonly teleported: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
readonly small: BooleanConstructor;
readonly size: {
readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<StringConstructor, "" | "small" | "default" | "large", never>>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly background: BooleanConstructor;
readonly disabled: BooleanConstructor;
readonly hideOnSinglePage: BooleanConstructor;
readonly appendSizeTo: StringConstructor;
}, () => VNode<import("vue").RendererNode, import("vue").RendererElement, {
[key: string]: any;
}> | null, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
'update:current-page': (val: number) => boolean;
'update:page-size': (val: number) => boolean;
'size-change': (val: number) => boolean;
change: (currentPage: number, pageSize: number) => boolean;
'current-change': (val: number) => boolean;
'prev-click': (val: number) => boolean;
'next-click': (val: number) => boolean;
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<ExtractPropTypes<{
readonly pageSize: NumberConstructor;
readonly defaultPageSize: NumberConstructor;
readonly total: NumberConstructor;
readonly pageCount: NumberConstructor;
readonly pagerCount: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 7, boolean>;
readonly currentPage: NumberConstructor;
readonly defaultCurrentPage: NumberConstructor;
readonly layout: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, string, boolean>;
readonly pageSizes: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => number[]) | (() => number[]) | ((new (...args: any[]) => number[]) | (() => number[]))[], unknown, unknown, () => [10, 20, 30, 40, 50, 100], boolean>;
readonly popperClass: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
readonly prevText: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
readonly prevIcon: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => (string | import("vue").Component) & {}) | (() => string | import("vue").Component) | ((new (...args: any[]) => (string | import("vue").Component) & {}) | (() => string | import("vue").Component))[], unknown, unknown, () => any, boolean>;
readonly nextText: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
readonly nextIcon: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => (string | import("vue").Component) & {}) | (() => string | import("vue").Component) | ((new (...args: any[]) => (string | import("vue").Component) & {}) | (() => string | import("vue").Component))[], unknown, unknown, () => any, boolean>;
readonly teleported: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
readonly small: BooleanConstructor;
readonly size: {
readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<StringConstructor, "" | "small" | "default" | "large", never>>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly background: BooleanConstructor;
readonly disabled: BooleanConstructor;
readonly hideOnSinglePage: BooleanConstructor;
readonly appendSizeTo: StringConstructor;
}>> & {
onChange?: ((currentPage: number, pageSize: number) => any) | undefined;
"onUpdate:current-page"?: ((val: number) => any) | undefined;
"onUpdate:page-size"?: ((val: number) => any) | undefined;
"onSize-change"?: ((val: number) => any) | undefined;
"onCurrent-change"?: ((val: number) => any) | undefined;
"onPrev-click"?: ((val: number) => any) | undefined;
"onNext-click"?: ((val: number) => any) | undefined;
}, {
readonly small: boolean;
readonly disabled: boolean;
readonly background: boolean;
readonly layout: string;
readonly popperClass: string;
readonly teleported: import("element-plus/es/utils").EpPropMergeType<BooleanConstructor, unknown, unknown>;
readonly prevText: string;
readonly prevIcon: import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => (string | import("vue").Component) & {}) | (() => string | import("vue").Component) | ((new (...args: any[]) => (string | import("vue").Component) & {}) | (() => string | import("vue").Component))[], unknown, unknown>;
readonly nextText: string;
readonly nextIcon: import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => (string | import("vue").Component) & {}) | (() => string | import("vue").Component) | ((new (...args: any[]) => (string | import("vue").Component) & {}) | (() => string | import("vue").Component))[], unknown, unknown>;
readonly pageSizes: number[];
readonly pagerCount: number;
readonly hideOnSinglePage: boolean;
}>;
export default _default;

View File

@@ -0,0 +1,298 @@
import { defineComponent, getCurrentInstance, computed, ref, watch, provide, h } from 'vue';
import { ArrowLeft, ArrowRight } from '@element-plus/icons-vue';
import { elPaginationKey } from './constants.mjs';
import Prev from './components/prev2.mjs';
import Next from './components/next2.mjs';
import Sizes from './components/sizes.mjs';
import Jumper from './components/jumper2.mjs';
import Total from './components/total2.mjs';
import Pager from './components/pager2.mjs';
import { useSizeProp, useGlobalSize } from '../../../hooks/use-size/index.mjs';
import { buildProps, definePropType } from '../../../utils/vue/props/runtime.mjs';
import { isNumber } from '../../../utils/types.mjs';
import { mutable } from '../../../utils/typescript.mjs';
import { iconPropType } from '../../../utils/vue/icon.mjs';
import { useLocale } from '../../../hooks/use-locale/index.mjs';
import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
import { useDeprecated } from '../../../hooks/use-deprecated/index.mjs';
import { CHANGE_EVENT } from '../../../constants/event.mjs';
import { debugWarn } from '../../../utils/error.mjs';
const isAbsent = (v) => typeof v !== "number";
const paginationProps = buildProps({
pageSize: Number,
defaultPageSize: Number,
total: Number,
pageCount: Number,
pagerCount: {
type: Number,
validator: (value) => {
return isNumber(value) && Math.trunc(value) === value && value > 4 && value < 22 && value % 2 === 1;
},
default: 7
},
currentPage: Number,
defaultCurrentPage: Number,
layout: {
type: String,
default: ["prev", "pager", "next", "jumper", "->", "total"].join(", ")
},
pageSizes: {
type: definePropType(Array),
default: () => mutable([10, 20, 30, 40, 50, 100])
},
popperClass: {
type: String,
default: ""
},
prevText: {
type: String,
default: ""
},
prevIcon: {
type: iconPropType,
default: () => ArrowLeft
},
nextText: {
type: String,
default: ""
},
nextIcon: {
type: iconPropType,
default: () => ArrowRight
},
teleported: {
type: Boolean,
default: true
},
small: Boolean,
size: useSizeProp,
background: Boolean,
disabled: Boolean,
hideOnSinglePage: Boolean,
appendSizeTo: String
});
const paginationEmits = {
"update:current-page": (val) => isNumber(val),
"update:page-size": (val) => isNumber(val),
"size-change": (val) => isNumber(val),
change: (currentPage, pageSize) => isNumber(currentPage) && isNumber(pageSize),
"current-change": (val) => isNumber(val),
"prev-click": (val) => isNumber(val),
"next-click": (val) => isNumber(val)
};
const componentName = "ElPagination";
var Pagination = defineComponent({
name: componentName,
props: paginationProps,
emits: paginationEmits,
setup(props, { emit, slots }) {
const { t } = useLocale();
const ns = useNamespace("pagination");
const vnodeProps = getCurrentInstance().vnode.props || {};
const _globalSize = useGlobalSize();
const _size = computed(() => {
var _a;
return props.small ? "small" : (_a = props.size) != null ? _a : _globalSize.value;
});
useDeprecated({
from: "small",
replacement: "size",
version: "3.0.0",
scope: "el-pagination",
ref: "https://element-plus.org/zh-CN/component/pagination.html"
}, computed(() => !!props.small));
const hasCurrentPageListener = "onUpdate:currentPage" in vnodeProps || "onUpdate:current-page" in vnodeProps || "onCurrentChange" in vnodeProps;
const hasPageSizeListener = "onUpdate:pageSize" in vnodeProps || "onUpdate:page-size" in vnodeProps || "onSizeChange" in vnodeProps;
const assertValidUsage = computed(() => {
if (isAbsent(props.total) && isAbsent(props.pageCount))
return false;
if (!isAbsent(props.currentPage) && !hasCurrentPageListener)
return false;
if (props.layout.includes("sizes")) {
if (!isAbsent(props.pageCount)) {
if (!hasPageSizeListener)
return false;
} else if (!isAbsent(props.total)) {
if (!isAbsent(props.pageSize)) {
if (!hasPageSizeListener) {
return false;
}
}
}
}
return true;
});
const innerPageSize = ref(isAbsent(props.defaultPageSize) ? 10 : props.defaultPageSize);
const innerCurrentPage = ref(isAbsent(props.defaultCurrentPage) ? 1 : props.defaultCurrentPage);
const pageSizeBridge = computed({
get() {
return isAbsent(props.pageSize) ? innerPageSize.value : props.pageSize;
},
set(v) {
if (isAbsent(props.pageSize)) {
innerPageSize.value = v;
}
if (hasPageSizeListener) {
emit("update:page-size", v);
emit("size-change", v);
}
}
});
const pageCountBridge = computed(() => {
let pageCount = 0;
if (!isAbsent(props.pageCount)) {
pageCount = props.pageCount;
} else if (!isAbsent(props.total)) {
pageCount = Math.max(1, Math.ceil(props.total / pageSizeBridge.value));
}
return pageCount;
});
const currentPageBridge = computed({
get() {
return isAbsent(props.currentPage) ? innerCurrentPage.value : props.currentPage;
},
set(v) {
let newCurrentPage = v;
if (v < 1) {
newCurrentPage = 1;
} else if (v > pageCountBridge.value) {
newCurrentPage = pageCountBridge.value;
}
if (isAbsent(props.currentPage)) {
innerCurrentPage.value = newCurrentPage;
}
if (hasCurrentPageListener) {
emit("update:current-page", newCurrentPage);
emit("current-change", newCurrentPage);
}
}
});
watch(pageCountBridge, (val) => {
if (currentPageBridge.value > val)
currentPageBridge.value = val;
});
watch([currentPageBridge, pageSizeBridge], (value) => {
emit(CHANGE_EVENT, ...value);
}, { flush: "post" });
function handleCurrentChange(val) {
currentPageBridge.value = val;
}
function handleSizeChange(val) {
pageSizeBridge.value = val;
const newPageCount = pageCountBridge.value;
if (currentPageBridge.value > newPageCount) {
currentPageBridge.value = newPageCount;
}
}
function prev() {
if (props.disabled)
return;
currentPageBridge.value -= 1;
emit("prev-click", currentPageBridge.value);
}
function next() {
if (props.disabled)
return;
currentPageBridge.value += 1;
emit("next-click", currentPageBridge.value);
}
function addClass(element, cls) {
if (element) {
if (!element.props) {
element.props = {};
}
element.props.class = [element.props.class, cls].join(" ");
}
}
provide(elPaginationKey, {
pageCount: pageCountBridge,
disabled: computed(() => props.disabled),
currentPage: currentPageBridge,
changeEvent: handleCurrentChange,
handleSizeChange
});
return () => {
var _a, _b;
if (!assertValidUsage.value) {
debugWarn(componentName, t("el.pagination.deprecationWarning"));
return null;
}
if (!props.layout)
return null;
if (props.hideOnSinglePage && pageCountBridge.value <= 1)
return null;
const rootChildren = [];
const rightWrapperChildren = [];
const rightWrapperRoot = h("div", { class: ns.e("rightwrapper") }, rightWrapperChildren);
const TEMPLATE_MAP = {
prev: h(Prev, {
disabled: props.disabled,
currentPage: currentPageBridge.value,
prevText: props.prevText,
prevIcon: props.prevIcon,
onClick: prev
}),
jumper: h(Jumper, {
size: _size.value
}),
pager: h(Pager, {
currentPage: currentPageBridge.value,
pageCount: pageCountBridge.value,
pagerCount: props.pagerCount,
onChange: handleCurrentChange,
disabled: props.disabled
}),
next: h(Next, {
disabled: props.disabled,
currentPage: currentPageBridge.value,
pageCount: pageCountBridge.value,
nextText: props.nextText,
nextIcon: props.nextIcon,
onClick: next
}),
sizes: h(Sizes, {
pageSize: pageSizeBridge.value,
pageSizes: props.pageSizes,
popperClass: props.popperClass,
disabled: props.disabled,
teleported: props.teleported,
size: _size.value,
appendSizeTo: props.appendSizeTo
}),
slot: (_b = (_a = slots == null ? void 0 : slots.default) == null ? void 0 : _a.call(slots)) != null ? _b : null,
total: h(Total, { total: isAbsent(props.total) ? 0 : props.total })
};
const components = props.layout.split(",").map((item) => item.trim());
let haveRightWrapper = false;
components.forEach((c) => {
if (c === "->") {
haveRightWrapper = true;
return;
}
if (!haveRightWrapper) {
rootChildren.push(TEMPLATE_MAP[c]);
} else {
rightWrapperChildren.push(TEMPLATE_MAP[c]);
}
});
addClass(rootChildren[0], ns.is("first"));
addClass(rootChildren[rootChildren.length - 1], ns.is("last"));
if (haveRightWrapper && rightWrapperChildren.length > 0) {
addClass(rightWrapperChildren[0], ns.is("first"));
addClass(rightWrapperChildren[rightWrapperChildren.length - 1], ns.is("last"));
rootChildren.push(rightWrapperRoot);
}
return h("div", {
class: [
ns.b(),
ns.is("background", props.background),
ns.m(_size.value)
]
}, rootChildren);
};
}
});
export { Pagination as default, paginationEmits, paginationProps };
//# sourceMappingURL=pagination.mjs.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
export declare const usePagination: () => import("./constants").ElPaginationContext;

View File

@@ -0,0 +1,7 @@
import { inject } from 'vue';
import { elPaginationKey } from './constants.mjs';
const usePagination = () => inject(elPaginationKey, {});
export { usePagination };
//# sourceMappingURL=usePagination.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"usePagination.mjs","sources":["../../../../../../packages/components/pagination/src/usePagination.ts"],"sourcesContent":["import { inject } from 'vue'\nimport { elPaginationKey } from './constants'\n\nexport const usePagination = () => inject(elPaginationKey, {})\n"],"names":[],"mappings":";;;AAEY,MAAC,aAAa,GAAG,MAAM,MAAM,CAAC,eAAe,EAAE,EAAE;;;;"}

View File

@@ -0,0 +1,4 @@
import 'element-plus/es/components/base/style/css';
import 'element-plus/theme-chalk/el-pagination.css';
import 'element-plus/es/components/select/style/css';
import 'element-plus/es/components/input/style/css';

View File

@@ -0,0 +1,5 @@
import '../../base/style/css.mjs';
import 'element-plus/theme-chalk/el-pagination.css';
import '../../select/style/css.mjs';
import '../../input/style/css.mjs';
//# sourceMappingURL=css.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"css.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}

View File

@@ -0,0 +1,4 @@
import 'element-plus/es/components/base/style';
import 'element-plus/theme-chalk/src/pagination.scss';
import 'element-plus/es/components/select/style';
import 'element-plus/es/components/input/style';

View File

@@ -0,0 +1,5 @@
import '../../base/style/index.mjs';
import 'element-plus/theme-chalk/src/pagination.scss';
import '../../select/style/index.mjs';
import '../../input/style/index.mjs';
//# sourceMappingURL=index.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}