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