f350b496314df635b5d2c23ec8f75ac7beb54f073e78cdb4f016a734961177725c41dbbc03fdbfe361041a4495dfc78894dcfdd36c96bd5241d4092251445f 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. import { defineComponent, ref, computed, openBlock, createElementBlock, normalizeClass, unref, createElementVNode, toDisplayString, createVNode } from 'vue';
  2. import { ElInput } from '../../../input/index.mjs';
  3. import { usePagination } from '../usePagination.mjs';
  4. import { paginationJumperProps } from './jumper.mjs';
  5. import _export_sfc from '../../../../_virtual/plugin-vue_export-helper.mjs';
  6. import { useLocale } from '../../../../hooks/use-locale/index.mjs';
  7. import { useNamespace } from '../../../../hooks/use-namespace/index.mjs';
  8. const __default__ = defineComponent({
  9. name: "ElPaginationJumper"
  10. });
  11. const _sfc_main = /* @__PURE__ */ defineComponent({
  12. ...__default__,
  13. props: paginationJumperProps,
  14. setup(__props) {
  15. const { t } = useLocale();
  16. const ns = useNamespace("pagination");
  17. const { pageCount, disabled, currentPage, changeEvent } = usePagination();
  18. const userInput = ref();
  19. const innerValue = computed(() => {
  20. var _a;
  21. return (_a = userInput.value) != null ? _a : currentPage == null ? void 0 : currentPage.value;
  22. });
  23. function handleInput(val) {
  24. userInput.value = val ? +val : "";
  25. }
  26. function handleChange(val) {
  27. val = Math.trunc(+val);
  28. changeEvent == null ? void 0 : changeEvent(val);
  29. userInput.value = void 0;
  30. }
  31. return (_ctx, _cache) => {
  32. return openBlock(), createElementBlock("span", {
  33. class: normalizeClass(unref(ns).e("jump")),
  34. disabled: unref(disabled)
  35. }, [
  36. createElementVNode("span", {
  37. class: normalizeClass([unref(ns).e("goto")])
  38. }, toDisplayString(unref(t)("el.pagination.goto")), 3),
  39. createVNode(unref(ElInput), {
  40. size: _ctx.size,
  41. class: normalizeClass([unref(ns).e("editor"), unref(ns).is("in-pagination")]),
  42. min: 1,
  43. max: unref(pageCount),
  44. disabled: unref(disabled),
  45. "model-value": unref(innerValue),
  46. "validate-event": false,
  47. "aria-label": unref(t)("el.pagination.page"),
  48. type: "number",
  49. "onUpdate:modelValue": handleInput,
  50. onChange: handleChange
  51. }, null, 8, ["size", "class", "max", "disabled", "model-value", "aria-label"]),
  52. createElementVNode("span", {
  53. class: normalizeClass([unref(ns).e("classifier")])
  54. }, toDisplayString(unref(t)("el.pagination.pageClassifier")), 3)
  55. ], 10, ["disabled"]);
  56. };
  57. }
  58. });
  59. var Jumper = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "jumper.vue"]]);
  60. export { Jumper as default };
  61. //# sourceMappingURL=jumper2.mjs.map