import { j as e } from "../../node_modules/react/jsx-runtime.mjs";
import { useState as x, useMemo as E } from "react";
import { isMobile as d } from "../../node_modules/react-device-detect/dist/lib.mjs";
import F from "../BitzDrawer/index.mjs";
import O from "../BitzLoadMore/index.mjs";
import y from "../BitzMobileLoading/index.mjs";
import D from "../BitzPagination/index.mjs";
import "./index.less.mjs";
import H from "../../node_modules/antd/es/table/Table.mjs";
const Q = ({
  tableItemEmit: c = () => {
  },
  showPagination: h = !0,
  dataSource: i = [],
  total: l = 0,
  columns: a,
  rowKey: b,
  loading: t = !1,
  tableOperationEmit: j = () => {
  },
  mobileLoadEmit: p = () => {
  },
  mobileRefreshEmit: f = () => {
  },
  operations: v = [],
  paginationEmit: N = () => {
  },
  mobilePageHeight: B = 500,
  mobileCancelText: M = "取消",
  ...g
}) => {
  const [L, o] = x(!1), [w, z] = x({}), C = E(() => i.length == l && (i == null ? void 0 : i.length) > 0, [i, l]), T = (s) => {
    o(!0), z(s), c(s);
  }, m = () => {
    o(!1);
  }, k = (s) => {
    o(!1), j(s.type, w);
  };
  return /* @__PURE__ */ e.jsxs("div", { className: "bitzTableBlock", children: [
    !d && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
      /* @__PURE__ */ e.jsx(H, { rowKey: b, ...g, columns: a, dataSource: i, pagination: !1, loading: t }),
      h && /* @__PURE__ */ e.jsx(D, { total: l, dataSource: i, paginationEmit: N })
    ] }),
    d && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
      /* @__PURE__ */ e.jsx(
        O,
        {
          height: B,
          showNoMore: C,
          refreshEmit: f,
          loadEmit: p,
          extra: /* @__PURE__ */ e.jsxs("div", { className: "mobileTable", children: [
            i.map((s, r) => /* @__PURE__ */ e.jsxs("div", { children: [
              /* @__PURE__ */ e.jsx("div", { className: "rowBox", children: a.map((n, u) => /* @__PURE__ */ e.jsx("div", { children: !n.mobileHide && /* @__PURE__ */ e.jsxs(
                "div",
                {
                  className: "row",
                  onClick: () => {
                    T(s);
                  },
                  children: [
                    /* @__PURE__ */ e.jsxs("div", { className: "label", children: [
                      n.title,
                      "："
                    ] }),
                    /* @__PURE__ */ e.jsx("div", { className: "value", children: n.render("", s) })
                  ]
                }
              ) }, u)) }),
              /* @__PURE__ */ e.jsx("div", { className: "rowBoxLine" })
            ] }, r)),
            /* @__PURE__ */ e.jsx(F, { className: "tableMobileDrawer", open: L, placement: "bottom", height: "auto", closable: !1, onClose: m, children: /* @__PURE__ */ e.jsxs("div", { className: "drawerBox", children: [
              /* @__PURE__ */ e.jsx("div", { className: "boxBody", children: v.map((s, r) => /* @__PURE__ */ e.jsx(
                "div",
                {
                  className: "operaList",
                  onClick: () => {
                    k(s);
                  },
                  children: s.label
                },
                r
              )) }),
              /* @__PURE__ */ e.jsx("div", { className: "boxLine" }),
              /* @__PURE__ */ e.jsx("div", { className: "boxFooter", onClick: m, children: M })
            ] }) })
          ] })
        }
      ),
      /* @__PURE__ */ e.jsx(y, { loading: t })
    ] })
  ] });
};
export {
  Q as default
};
