import { unref as p, isRef as s } from "vue";
import { q as i, r as u, w as r, B as l } from "./index-a68a4fdc.mjs";
function c({ config: a, data: t }) {
  const n = {
    "~component": "el-pagination",
    "~modelValueName": "currentPage",
    //modelValue: unref(value)[config['_key-current-page'] || 'page'],
    "~modelValue": p(t),
    "~modelValuePath": a["_key-current-page"] || "page",
    "@update:current-page": function(e, o) {
      !a._sync_to_data || !t || (s(t) ? t.value[a["_key-current-page"] || "page"] = o : t[a["_key-current-page"] || "page"] = o);
    },
    "@update:page-size": function(e, o) {
      !a._sync_to_data || !t || !a["_key-page-size"] || (s(t) ? t.value[a["_key-page-size"] || "page"] = o : t[a["_key-page-size"] || "page"] = o);
    }
  };
  for (const e of Object.keys(a))
    if (a[e]) {
      if (e == "page-sizes") {
        n[e] = JSON.parse(a[e]);
        continue;
      } else {
        if (e == "_key-current-page")
          continue;
        if (e == "_sync_to_data")
          continue;
        if (e == "_key-total") {
          n.total = p(t)[a[e]];
          continue;
        } else if (e == "_key-page-count") {
          n["page-count"] = p(t)[a[e]];
          continue;
        } else if (e == "_key-page-size") {
          n["page-size"] = p(t)[a[e]];
          continue;
        }
      }
      n[e] = a[e];
    }
  return n.total == null && (n.total = 0), n;
}
const y = {
  key: "_pagination",
  name: "Pagination",
  description: "Basic pagination",
  icon: "mdiBookOpenPageVariantOutline",
  sequence: 41,
  transform: c,
  editor: {
    basic: {
      ui: [
        i("layout"),
        u("pager-count"),
        r("small"),
        r("background"),
        i("page-sizes"),
        i("prev-text"),
        l("prev-icon"),
        i("next-text"),
        l("next-icon"),
        r("disabled"),
        r("hide-on-single-page"),
        r("_sync_to_data", "Synchronize currrent page and page size to data"),
        i("_key-current-page", "Field name of current page in model value"),
        i("_key-total", "Field name of total elements in model value"),
        i("_key-page-count", "Field name of page count in model value"),
        i("_key-page-size", "Field name of page size in model value")
      ],
      init: {
        layout: "prev, pager, next, jumper, ->, total",
        "pager-count": 7,
        small: !1,
        background: !1,
        "page-sizes": "[10, 20, 30, 40, 50, 100]",
        //'default-page-size':10,
        disabled: !1,
        "hide-on-single-page": !1,
        _sync_to_data: !0,
        "_key-current-page": "page",
        "_key-total": "total",
        "_key-page-size": "size"
      }
    },
    data: {
      //readonly:true,
      type: "Object"
    },
    event: {
      list: ["size-change", "current-change", "prev-click", "next-click"],
      init: []
    },
    display: {
      init: {
        style: {
          margin: "6px 0"
        }
      }
    }
  }
};
export {
  y as default
};
