87ae4a373a8ecb6f05ec5bcaeceddec581d291631022ff5b005373c71679ac6045fcb8060dc369b4f765738b1d569f12e4491c31e8ffb52e8a4e5b51417f03 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. 'use strict';
  2. Object.defineProperty(exports, '__esModule', { value: true });
  3. var vue = require('vue');
  4. var lodashUnified = require('lodash-unified');
  5. var index$2 = require('../../../select/index.js');
  6. var usePagination = require('../usePagination.js');
  7. var sizes = require('./sizes2.js');
  8. var pluginVue_exportHelper = require('../../../../_virtual/plugin-vue_export-helper.js');
  9. var index = require('../../../../hooks/use-locale/index.js');
  10. var index$1 = require('../../../../hooks/use-namespace/index.js');
  11. var shared = require('@vue/shared');
  12. const __default__ = vue.defineComponent({
  13. name: "ElPaginationSizes"
  14. });
  15. const _sfc_main = /* @__PURE__ */ vue.defineComponent({
  16. ...__default__,
  17. props: sizes.paginationSizesProps,
  18. emits: ["page-size-change"],
  19. setup(__props, { emit }) {
  20. const props = __props;
  21. const { t } = index.useLocale();
  22. const ns = index$1.useNamespace("pagination");
  23. const pagination = usePagination.usePagination();
  24. const innerPageSize = vue.ref(props.pageSize);
  25. vue.watch(() => props.pageSizes, (newVal, oldVal) => {
  26. if (lodashUnified.isEqual(newVal, oldVal))
  27. return;
  28. if (shared.isArray(newVal)) {
  29. const pageSize = newVal.includes(props.pageSize) ? props.pageSize : props.pageSizes[0];
  30. emit("page-size-change", pageSize);
  31. }
  32. });
  33. vue.watch(() => props.pageSize, (newVal) => {
  34. innerPageSize.value = newVal;
  35. });
  36. const innerPageSizes = vue.computed(() => props.pageSizes);
  37. function handleChange(val) {
  38. var _a;
  39. if (val !== innerPageSize.value) {
  40. innerPageSize.value = val;
  41. (_a = pagination.handleSizeChange) == null ? void 0 : _a.call(pagination, Number(val));
  42. }
  43. }
  44. return (_ctx, _cache) => {
  45. return vue.openBlock(), vue.createElementBlock("span", {
  46. class: vue.normalizeClass(vue.unref(ns).e("sizes"))
  47. }, [
  48. vue.createVNode(vue.unref(index$2.ElSelect), {
  49. "model-value": innerPageSize.value,
  50. disabled: _ctx.disabled,
  51. "popper-class": _ctx.popperClass,
  52. size: _ctx.size,
  53. teleported: _ctx.teleported,
  54. "validate-event": false,
  55. "append-to": _ctx.appendSizeTo,
  56. onChange: handleChange
  57. }, {
  58. default: vue.withCtx(() => [
  59. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(innerPageSizes), (item) => {
  60. return vue.openBlock(), vue.createBlock(vue.unref(index$2.ElOption), {
  61. key: item,
  62. value: item,
  63. label: item + vue.unref(t)("el.pagination.pagesize")
  64. }, null, 8, ["value", "label"]);
  65. }), 128))
  66. ]),
  67. _: 1
  68. }, 8, ["model-value", "disabled", "popper-class", "size", "teleported", "append-to"])
  69. ], 2);
  70. };
  71. }
  72. });
  73. var Sizes = /* @__PURE__ */ pluginVue_exportHelper["default"](_sfc_main, [["__file", "sizes.vue"]]);
  74. exports["default"] = Sizes;
  75. //# sourceMappingURL=sizes.js.map