You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 line
6.2 KiB
1 line
6.2 KiB
{"ast":null,"code":"import { defineComponent, ref, watch, computed, openBlock, createElementBlock, normalizeClass, unref, createVNode, withCtx, Fragment, renderList, createBlock } from 'vue';\nimport { isEqual } from 'lodash-unified';\nimport { ElSelect, ElOption } from '../../../select/index.mjs';\nimport '../../../../hooks/index.mjs';\nimport { usePagination } from '../usePagination.mjs';\nimport { paginationSizesProps } from './sizes.mjs';\nimport _export_sfc from '../../../../_virtual/plugin-vue_export-helper.mjs';\nimport { useLocale } from '../../../../hooks/use-locale/index.mjs';\nimport { useNamespace } from '../../../../hooks/use-namespace/index.mjs';\nconst __default__ = defineComponent({\n name: \"ElPaginationSizes\"\n});\nconst _sfc_main = /* @__PURE__ */defineComponent({\n ...__default__,\n props: paginationSizesProps,\n emits: [\"page-size-change\"],\n setup(__props, {\n emit\n }) {\n const props = __props;\n const {\n t\n } = useLocale();\n const ns = useNamespace(\"pagination\");\n const pagination = usePagination();\n const innerPageSize = ref(props.pageSize);\n watch(() => props.pageSizes, (newVal, oldVal) => {\n if (isEqual(newVal, oldVal)) return;\n if (Array.isArray(newVal)) {\n const pageSize = newVal.includes(props.pageSize) ? props.pageSize : props.pageSizes[0];\n emit(\"page-size-change\", pageSize);\n }\n });\n watch(() => props.pageSize, newVal => {\n innerPageSize.value = newVal;\n });\n const innerPageSizes = computed(() => props.pageSizes);\n function handleChange(val) {\n var _a;\n if (val !== innerPageSize.value) {\n innerPageSize.value = val;\n (_a = pagination.handleSizeChange) == null ? void 0 : _a.call(pagination, Number(val));\n }\n }\n return (_ctx, _cache) => {\n return openBlock(), createElementBlock(\"span\", {\n class: normalizeClass(unref(ns).e(\"sizes\"))\n }, [createVNode(unref(ElSelect), {\n \"model-value\": innerPageSize.value,\n disabled: _ctx.disabled,\n \"popper-class\": _ctx.popperClass,\n size: _ctx.size,\n teleported: _ctx.teleported,\n \"validate-event\": false,\n \"append-to\": _ctx.appendSizeTo,\n onChange: handleChange\n }, {\n default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(unref(innerPageSizes), item => {\n return openBlock(), createBlock(unref(ElOption), {\n key: item,\n value: item,\n label: item + unref(t)(\"el.pagination.pagesize\")\n }, null, 8, [\"value\", \"label\"]);\n }), 128))]),\n _: 1\n }, 8, [\"model-value\", \"disabled\", \"popper-class\", \"size\", \"teleported\", \"append-to\"])], 2);\n };\n }\n});\nvar Sizes = /* @__PURE__ */_export_sfc(_sfc_main, [[\"__file\", \"sizes.vue\"]]);\nexport { Sizes as default };","map":{"version":3,"names":["name","t","useLocale","ns","useNamespace","pagination","usePagination","innerPageSize","ref","props","pageSize","watch","pageSizes","newVal","oldVal","isEqual","Array","isArray","includes","emit","value","innerPageSizes","computed","handleChange","val","_a","handleSizeChange","call","Number","_ctx","_cache","openBlock","createElementBlock","class","normalizeClass","unref","e"],"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 { 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 (Array.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"],"mappings":";;;;;;;;;mCA8Bc;EACZA,IAAM;AACR;;;;;;;;;IAIM;MAAEC;IAAE,IAAIC,SAAU;IAClB,MAAAC,EAAA,GAAKC,YAAA,CAAa,YAAY;IACpC,MAAMC,UAAA,GAAaC,aAAc;IAC3B,MAAAC,aAAA,GAAgBC,GAAY,CAAAC,KAAA,CAAMC,QAAS;IAEjDC,KAAA,OAAAF,KAAA,CAAAG,SAAA,GAAAC,MAAA,EAAAC,MAAA;MACE,IAAAC,OAAY,CAAAF,MAAA,EAAAC,MAAA;MAEN,IAAAE,KAAA,CAAAC,OAAgB,CAAAJ,MAAA;QAChB,MAAAH,QAAc,GAAAG,MAAA,CAAMK,QAAG,CAAAT,KAAA,CAAAC,QAAA,IAAAD,KAAA,CAAAC,QAAA,GAAAD,KAAA,CAAAG,SAAA;QACnBO,IAAA,mBAAkB,EAAAT,QAAA;MAGxB;IAAiC,CACnC;IACFC,KAAA,OAAAF,KAAA,CAAAC,QAAA,EAAAG,MAAA;MACFN,aAAA,CAAAa,KAAA,GAAAP,MAAA;IAEA;IAAA,MAAAQ,cACc,GAAAC,QAAA,OAAAb,KAAA,CAAAG,SAAA;IAAA,SACAW,aAAAC,GAAA;MACV,IAAAC,EAAA;MACF,IAAAD,GAAA,KAAAjB,aAAA,CAAAa,KAAA;QACFb,aAAA,CAAAa,KAAA,GAAAI,GAAA;QAEA,CAAAC,EAAuB,GAAApB,UAAA,CAAAqB,gBAAe,SAAe,YAAAD,EAAA,CAAAE,IAAA,CAAAtB,UAAA,EAAAuB,MAAA,CAAAJ,GAAA;MACrD;IACE;IACE,QAAAK,IAAA,EAAAC,MAAsB;MACX,OAAAC,SAAA,IAAAC,kBAA0B,OAAI;QAC3CC,KAAA,EAAAC,cAAA,CAAAC,KAAA,CAAAhC,EAAA,EAAAiC,CAAA;MAAA,CACF,G","ignoreList":[]},"metadata":{},"sourceType":"module","externalDependencies":[]} |