"use strict";
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
require("../../../../node_modules/element-plus/es/index.js");
;/* empty css                                                          */
;/* empty css                                                              */
;/* empty css                                                                  */
;/* empty css                                                               */
;/* empty css                                                            */
;/* empty css                                                               */
;/* empty css                                                                     */
;/* empty css                                                               */
;/* empty css                                                                   */
;/* empty css                                                                */
;/* empty css                                                               */
const Vue = require("vue");
const common = require("../utils/common.js");
;/* empty css                      */
const _pluginVue_exportHelper = require("../../../../_virtual/_plugin-vue_export-helper.js");
const index = require("../../../../node_modules/element-plus/es/components/switch/index.js");
const index$1 = require("../../../../node_modules/element-plus/es/components/divider/index.js");
const index$2 = require("../../../../node_modules/element-plus/es/components/select/index.js");
const index$3 = require("../../../../node_modules/element-plus/es/components/pagination/index.js");
const _hoisted_1 = { class: "table-pagination-config" };
const _hoisted_2 = { class: "config-row" };
const _hoisted_3 = {
  key: 0,
  class: "page-slot"
};
const _sfc_main = {
  __name: "tablePagination",
  setup(__props) {
    var _a;
    const editConfigData = Vue.computed(() => common.getEditConfigData());
    const paginationConfig = Vue.reactive({
      enabled: true,
      pageSize: 15,
      pageSizes: [15, 20, 50, 100, 200, 500],
      layout: "full",
      background: true,
      size: "small",
      ...((_a = editConfigData.value) == null ? void 0 : _a.paginationConfig) || {}
    });
    Vue.watch(
      paginationConfig,
      (val) => {
        editConfigData.value.paginationConfig = val;
      },
      { deep: true }
    );
    const layoutMap = {
      simple: "->,prev, pager, next",
      standard: "total, ->, prev, pager, next, jumper",
      full: "total, slot, ->,sizes, prev, pager, next, jumper"
    };
    function getLayout(layout) {
      return layoutMap[layout] || layoutMap.full;
    }
    const showPagination = Vue.ref(true);
    function pageSizeChange() {
      showPagination.value = false;
      Vue.nextTick(() => {
        showPagination.value = true;
      });
    }
    return (_ctx, _cache) => {
      const _component_el_switch = index.ElSwitch;
      const _component_el_divider = index$1.ElDivider;
      const _component_el_option = index$2.ElOption;
      const _component_el_select = index$2.ElSelect;
      const _component_el_pagination = index$3.ElPagination;
      return Vue.openBlock(), Vue.createElementBlock("div", _hoisted_1, [
        Vue.createElementVNode("div", _hoisted_2, [
          _cache[2] || (_cache[2] = Vue.createElementVNode("span", { class: "config-label" }, "开启分页:", -1)),
          Vue.createVNode(_component_el_switch, {
            modelValue: paginationConfig.enabled,
            "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => paginationConfig.enabled = $event),
            size: "small"
          }, null, 8, ["modelValue"]),
          Vue.createVNode(_component_el_divider, { direction: "vertical" }),
          _cache[3] || (_cache[3] = Vue.createElementVNode("span", { class: "config-label" }, "每页条数:", -1)),
          Vue.createVNode(_component_el_select, {
            modelValue: paginationConfig.pageSize,
            "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => paginationConfig.pageSize = $event),
            size: "small",
            style: { "width": "100px" },
            onChange: pageSizeChange
          }, {
            default: Vue.withCtx(() => [
              Vue.createVNode(_component_el_option, {
                label: "15",
                value: 15
              }),
              Vue.createVNode(_component_el_option, {
                label: "20",
                value: 20
              }),
              Vue.createVNode(_component_el_option, {
                label: "50",
                value: 50
              }),
              Vue.createVNode(_component_el_option, {
                label: "100",
                value: 100
              }),
              Vue.createVNode(_component_el_option, {
                label: "200",
                value: 200
              }),
              Vue.createVNode(_component_el_option, {
                label: "500",
                value: 500
              })
            ]),
            _: 1
          }, 8, ["modelValue"])
        ]),
        Vue.createElementVNode("div", {
          class: Vue.normalizeClass(["preview-section", { disabled: !paginationConfig.enabled }])
        }, [
          Vue.unref(showPagination) ? (Vue.openBlock(), Vue.createBlock(_component_el_pagination, {
            key: 0,
            style: { "width": "100%" },
            "page-sizes": [15, 20, 50, 100, 200, 500],
            "default-page-size": paginationConfig.pageSize,
            layout: getLayout(paginationConfig.layout),
            total: 100,
            background: paginationConfig.background,
            size: paginationConfig.size === "default" ? "" : paginationConfig.size,
            disabled: !paginationConfig.enabled
          }, {
            default: Vue.withCtx(() => [
              getLayout(paginationConfig.layout).includes("slot") ? (Vue.openBlock(), Vue.createElementBlock("span", _hoisted_3, Vue.toDisplayString(1) + "/" + Vue.toDisplayString(Math.ceil(100 / paginationConfig.pageSize)) + "页 ", 1)) : Vue.createCommentVNode("", true)
            ]),
            _: 1
          }, 8, ["default-page-size", "layout", "background", "size", "disabled"])) : Vue.createCommentVNode("", true)
        ], 2)
      ]);
    };
  }
};
const TablePagination = /* @__PURE__ */ _pluginVue_exportHelper.default(_sfc_main, [["__scopeId", "data-v-12c51ab8"]]);
exports.default = TablePagination;
