bitz-react-admin-ui 1.4.2 → 1.4.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/README.md +2 -2
  2. package/dist/components/BitzPagination/index.mjs +17 -16
  3. package/dist/components/BitzTable/TableSkeleton/index.mjs +11 -14
  4. package/dist/components/BitzTable/index.mjs +44 -41
  5. package/dist/components/BitzTableActionCol/index.mjs +21 -22
  6. package/dist/components/BitzTableActionCol/style.mjs +29 -24
  7. package/dist/components/BitzTableProvider/index.mjs +18 -16
  8. package/dist/components/BitzTableToolBar/ColumnSetting/ColumnSettingModal.mjs +71 -67
  9. package/dist/components/BitzTableToolBar/ColumnSetting/index.mjs +17 -14
  10. package/dist/components/BitzTableToolBar/DensityIcon/index.mjs +17 -16
  11. package/dist/components/BitzTableToolBar/ExportIcon/index.mjs +15 -10
  12. package/dist/components/BitzTableToolBar/RefreshIcon/index.mjs +11 -12
  13. package/dist/components/BitzTableToolBar/Wrapper/index.mjs +10 -10
  14. package/dist/components/BitzTableToolBar/index.mjs +8 -6
  15. package/dist/components/BitzTableToolBar/style.mjs +13 -10
  16. package/dist/style.css +1 -1
  17. package/dist/type/components/BitzTable/index.d.ts +2 -2
  18. package/dist/type/components/BitzTableActionCol/index.d.ts +2 -3
  19. package/dist/type/components/BitzTableActionCol/style.d.ts +8 -0
  20. package/dist/type/components/BitzTableProvider/index.d.ts +4 -0
  21. package/dist/type/components/BitzTableToolBar/ColumnSetting/index.d.ts +5 -1
  22. package/dist/type/components/BitzTableToolBar/DensityIcon/index.d.ts +5 -2
  23. package/dist/type/components/BitzTableToolBar/ExportIcon/index.d.ts +1 -2
  24. package/dist/type/components/BitzTableToolBar/Wrapper/index.d.ts +14 -2
  25. package/dist/type/pages/Login2/index.d.ts +2 -0
  26. package/dist/type/pages/Login3/index.d.ts +2 -0
  27. package/package.json +2 -2
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Bitz的Admin组件
2
2
 
3
3
  ## 引入方式
4
- import 'bitz-react-admin-ui/dist/style.css'
5
- import { BitzTable } from 'bitz-react-admin-ui'
4
+ import 'bitz-react-admin/dist/style.css'
5
+ import { BitzTable } from 'bitz-react-admin'
6
6
 
@@ -1,26 +1,27 @@
1
- import { j as n } from "../../node_modules/react/jsx-runtime.mjs";
2
- import { useState as m, useMemo as x, useEffect as P } from "react";
3
- import { Pagination as S } from "antd";
4
- import { isMobile as b } from "../../node_modules/react-device-detect/dist/lib.mjs";
1
+ import { j as t } from "../../node_modules/react/jsx-runtime.mjs";
2
+ import { useState as m, useMemo as x, useEffect as S } from "react";
3
+ import { Pagination as P } from "antd";
4
+ import { isMobile as T } from "../../node_modules/react-device-detect/dist/lib.mjs";
5
+ import $ from "../BitzHighlight/index.mjs";
5
6
  import "./index.less.mjs";
6
7
  let r = !0;
7
- const y = ({ pageSizeOptions: u = [10, 20, 50, 100], total: h = 0, dataSource: o = [], resetPage: a = 0, paginationEmit: g = () => {
8
+ const R = ({ pageSizeOptions: l = [10, 20, 50, 100], total: u = 0, dataSource: o = [], resetPage: g = 0, paginationEmit: a = () => {
8
9
  }, direction: f = "end", totalText: p = "共", totalItemText: c = "条" }) => {
9
- const [l, s] = m(1), [z, C] = m(10), i = x(() => a, [a]);
10
- P(() => {
11
- i != 0 && s(i);
12
- }, [i]);
13
- const j = (e, t) => {
14
- s(e), r && g(e, t);
15
- }, w = (e, t) => {
16
- r = !1, C(t), setTimeout(() => {
17
- s(1), g(1, t), setTimeout(() => {
10
+ const [h, s] = m(1), [z, C] = m(10), n = x(() => g, [g]);
11
+ S(() => {
12
+ n != 0 && s(n);
13
+ }, [n]);
14
+ const j = (e, i) => {
15
+ s(e), r && a(e, i);
16
+ }, w = (e, i) => {
17
+ r = !1, C(i), setTimeout(() => {
18
+ s(1), a(1, i), setTimeout(() => {
18
19
  r = !0;
19
20
  }, 10);
20
21
  }, 10);
21
22
  };
22
- return n.jsx(n.Fragment, { children: (o == null ? void 0 : o.length) != 0 && !b && n.jsx("div", { className: "bitzPaginationBlock", style: { justifyContent: f }, children: n.jsx(S, { size: "small", total: h, defaultCurrent: l, current: l, pageSize: z, showSizeChanger: !0, showQuickJumper: !0, pageSizeOptions: u, showTotal: (e) => `${p} ${e} ${c}`, onChange: j, onShowSizeChange: w }) }) });
23
+ return t.jsx(t.Fragment, { children: (o == null ? void 0 : o.length) != 0 && !T && t.jsx("div", { className: "bitzPaginationBlock", style: { justifyContent: f }, children: t.jsx(P, { size: "small", total: u, defaultCurrent: h, current: h, pageSize: z, showSizeChanger: !0, showQuickJumper: !0, pageSizeOptions: l, showTotal: (e) => t.jsx($, { highlightTag: "strong", keywords: `${e}`, sourceString: `${p} ${e} ${c}` }), onChange: j, onShowSizeChange: w }) }) });
23
24
  };
24
25
  export {
25
- y as default
26
+ R as default
26
27
  };
@@ -1,21 +1,18 @@
1
- import { j as a } from "../../../node_modules/react/jsx-runtime.mjs";
2
- import { Skeleton as s, Table as n } from "antd";
3
- const j = ({ columns: r, dataLength: o }) => {
4
- const i = Array.from({
5
- length: o < 4 ? 4 : o
6
- }).map((e, t) => ({ index: t })), p = r == null ? void 0 : r.map((e, t) => t === r.length - 1 ? {
7
- ...e,
8
- render: () => a.jsx(s, { active: !0, title: !1, paragraph: { rows: 1, width: "100%" } })
9
- } : {
10
- ...e,
1
+ import { j as o } from "../../../node_modules/react/jsx-runtime.mjs";
2
+ import { Skeleton as n, Table as p } from "antd";
3
+ const m = ({ columns: e, dataLength: t }) => {
4
+ const s = Array.from({
5
+ length: t < 4 ? 4 : t
6
+ }).map((r, a) => ({ index: a })), i = e == null ? void 0 : e.map((r) => r != null && r.fixed ? r : {
7
+ ...r,
11
8
  sorter: !1,
12
- render: (f, d, l) => a.jsx(s, { active: !0, title: !1, paragraph: {
9
+ render: (a, l, f) => o.jsx(n, { active: !0, title: !1, paragraph: {
13
10
  rows: 1,
14
- width: (l + 1) % 2 === 0 ? "100%" : "60%"
11
+ width: (f + 1) % 2 === 0 ? "100%" : "60%"
15
12
  } })
16
13
  });
17
- return a.jsx(n, { columns: p, rowKey: "index", dataSource: i });
14
+ return o.jsx(p, { columns: i, rowKey: "index", dataSource: s });
18
15
  };
19
16
  export {
20
- j as default
17
+ m as default
21
18
  };
@@ -1,34 +1,34 @@
1
1
  import { j as e } from "../../node_modules/react/jsx-runtime.mjs";
2
- import { useContext as X, useState as g, useMemo as h, useEffect as Y } from "react";
3
- import { isMobile as v } from "../../node_modules/react-device-detect/dist/lib.mjs";
2
+ import { useContext as X, useState as p, useMemo as f, useEffect as Y } from "react";
3
+ import { isMobile as w } from "../../node_modules/react-device-detect/dist/lib.mjs";
4
4
  import { Table as Z, Skeleton as I } from "antd";
5
5
  import S from "../BitzDrawer/index.mjs";
6
6
  import ee from "../BitzLoadMore/index.mjs";
7
7
  import se from "../BitzPagination/index.mjs";
8
8
  import le from "../BitzNoData/index.mjs";
9
9
  import ne from "./ToolBar/index.mjs";
10
- import { TableContext as oe } from "../BitzTableProvider/index.mjs";
10
+ import oe, { TableContext as ie } from "../BitzTableProvider/index.mjs";
11
11
  import re from "./TableSkeleton/index.mjs";
12
- import { columnSort as ie, genColumnKey as w } from "../BitzTableProvider/utils/index.mjs";
12
+ import { columnSort as te, genColumnKey as N } from "../BitzTableProvider/utils/index.mjs";
13
13
  import "./index.less.mjs";
14
- import te from "../../node_modules/lodash-es/at.mjs";
15
- const ze = ({
16
- tableItemEmit: N = () => {
14
+ import ae from "../../node_modules/lodash-es/at.mjs";
15
+ const xe = ({
16
+ tableItemEmit: h = () => {
17
17
  },
18
18
  showPagination: B = !0,
19
19
  dataSource: l = [],
20
- total: f = 0,
20
+ total: d = 0,
21
21
  columns: t,
22
22
  loading: x = !1,
23
23
  skeletonNum: z = 2,
24
- skeletonRender: m,
25
- skeletonRowNum: M = 4,
24
+ skeletonRender: j,
25
+ skeletonRowNum: L = 4,
26
26
  skeletonRowsWidth: T = ["35%", "100%", "100%", "60%"],
27
27
  tableOperationEmit: u = () => {
28
28
  },
29
- mobileLoadEmit: y = () => {
29
+ mobileLoadEmit: M = () => {
30
30
  },
31
- mobileRefreshEmit: L = () => {
31
+ mobileRefreshEmit: y = () => {
32
32
  },
33
33
  operations: C = [],
34
34
  paginationEmit: k = () => {
@@ -39,30 +39,30 @@ const ze = ({
39
39
  noDataImg: A,
40
40
  color: D,
41
41
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
42
- size: j,
43
- pagination: ae = !1,
42
+ size: b,
43
+ pagination: ce = !1,
44
44
  showTableTool: O = !0,
45
- tableAction: $,
46
- tableToolbar: P,
45
+ tableAction: P,
46
+ tableToolbar: $,
47
47
  resetPage: _,
48
48
  ...a
49
49
  }) => {
50
- const i = X(oe), [H, d] = g(!1), [W, q] = g({}), G = h(() => (l == null ? void 0 : l.length) == f && (l == null ? void 0 : l.length) > 0, [l, f]), J = (s) => {
51
- d(!0), q(s), N(s);
52
- }, b = () => {
53
- d(!1);
54
- }, Q = (s) => {
55
- d(!1), u(s.type, W);
56
- }, c = h(() => {
57
- const s = (r) => r.map((o) => {
58
- const V = w((o == null ? void 0 : o.key) || (o == null ? void 0 : o.dataIndex), o.index), p = i.columnsMap[V];
59
- return p && p.show === !1 ? !1 : o.children ? {
50
+ const r = X(ie), [H, m] = p(!1), [V, W] = p({}), q = f(() => (l == null ? void 0 : l.length) == d && (l == null ? void 0 : l.length) > 0, [l, d]), G = (s) => {
51
+ m(!0), W(s), h(s);
52
+ }, g = () => {
53
+ m(!1);
54
+ }, J = (s) => {
55
+ m(!1), u(s.type, V);
56
+ }, c = f(() => {
57
+ const s = (i) => i.map((o) => {
58
+ const U = N((o == null ? void 0 : o.key) || (o == null ? void 0 : o.dataIndex), o.index), v = r.columnList[U];
59
+ return v && v.show === !1 ? !1 : o.children ? {
60
60
  ...o,
61
61
  children: s(o.children)
62
62
  } : o;
63
63
  }).filter(Boolean);
64
- return s(t).sort(ie(i.columnsMap));
65
- }, [i.columnsMap, t]), R = h(() => {
64
+ return s(t).sort(te(r.columnList));
65
+ }, [r.columnList, t]), Q = f(() => {
66
66
  if (a != null && a.rowSelection)
67
67
  return {
68
68
  ...a.rowSelection,
@@ -74,23 +74,26 @@ const ze = ({
74
74
  if (t && t.length > 0) {
75
75
  const s = t.map((n) => (
76
76
  // @ts-ignore
77
- w((n == null ? void 0 : n.key) ?? (n == null ? void 0 : n.dataIndex), n == null ? void 0 : n.dataIndex)
77
+ N((n == null ? void 0 : n.key) ?? (n == null ? void 0 : n.dataIndex), n == null ? void 0 : n.dataIndex)
78
78
  ));
79
- i.setSortKeyColumns(s);
79
+ r.setSortKeyColumns(s);
80
80
  }
81
81
  }, [t]);
82
- const U = h(() => `${j ?? (i == null ? void 0 : i.tableSize) ?? "lg"}BitzTable`, [j, i.tableSize]);
83
- return e.jsxs("div", { className: "bitzTableBlock", children: [!v && e.jsxs("div", { className: `bitzTableContainer ${U}`, children: [O && e.jsx(ne, { tableAction: $, tableToolbar: P }), x ? e.jsx(re, { columns: c, dataLength: l == null ? void 0 : l.length }) : e.jsx(Z, { columns: c, dataSource: l, pagination: {
82
+ const R = f(() => `${b ?? (r == null ? void 0 : r.tableSize) ?? "lg"}BitzTable`, [b, r.tableSize]);
83
+ return e.jsxs("div", { className: "bitzTableBlock", children: [!w && e.jsxs("div", { className: `bitzTableContainer ${R}`, children: [O && e.jsx(ne, { tableAction: P, tableToolbar: $ }), x ? e.jsx(re, { columns: c, dataLength: l == null ? void 0 : l.length }) : e.jsx(Z, { columns: c, dataSource: l, pagination: {
84
84
  showTotal: (s) => e.jsx(e.Fragment, { children: s })
85
- }, loading: x, size: "large", rowSelection: R, scroll: { x: 1e3 }, ...a }), B && e.jsx(se, { total: f, dataSource: l, resetPage: _, paginationEmit: k })] }), v && e.jsxs(e.Fragment, { children: [(x || (l == null ? void 0 : l.length) > 0) && e.jsx(ee, { color: D, height: F, showNoMore: G, refreshEmit: L, loadEmit: y, extra: e.jsxs("div", { className: "mobileTable", children: [l == null ? void 0 : l.map((s, n) => e.jsxs("div", { children: [e.jsx("div", { className: "rowBox", children: c == null ? void 0 : c.map((r, o) => e.jsx("div", { children: !(r != null && r.mobileHide) && e.jsxs("div", { className: "row", onClick: () => {
86
- J(s);
87
- }, children: [e.jsxs("div", { className: "label", children: [r.title, ":"] }), e.jsx("div", { className: "value", children: r.render(te(s, r == null ? void 0 : r.dataIndex), s, n) })] }) }, o)) }), e.jsx("div", { className: "rowBoxLine" })] }, n)), x && Array.from({ length: z }).map((s, n) => e.jsxs("div", { children: [e.jsx("div", { className: "rowBox", children: m ? m() : e.jsx(I, { title: !1, paragraph: {
88
- rows: M,
85
+ }, loading: x, size: "large", rowSelection: Q, scroll: { x: 1e3 }, ...a }), B && e.jsx(se, { total: d, dataSource: l, resetPage: _, paginationEmit: k })] }), w && e.jsxs(e.Fragment, { children: [(x || (l == null ? void 0 : l.length) > 0) && e.jsx(ee, { color: D, height: F, showNoMore: q, refreshEmit: y, loadEmit: M, extra: e.jsxs("div", { className: "mobileTable", children: [l == null ? void 0 : l.map((s, n) => e.jsxs("div", { children: [e.jsx("div", { className: "rowBox", children: c == null ? void 0 : c.map((i, o) => e.jsx("div", { children: !(i != null && i.mobileHide) && e.jsxs("div", { className: "row", onClick: () => {
86
+ G(s);
87
+ }, children: [e.jsxs("div", { className: "label", children: [i.title, ":"] }), e.jsx("div", { className: "value", children: i.render(ae(s, i == null ? void 0 : i.dataIndex), s, n) })] }) }, o)) }), e.jsx("div", { className: "rowBoxLine" })] }, n)), x && Array.from({ length: z }).map((s, n) => e.jsxs("div", { children: [e.jsx("div", { className: "rowBox", children: j ? j() : e.jsx(I, { title: !1, paragraph: {
88
+ rows: L,
89
89
  width: T
90
- }, active: !0 }) }), e.jsx("div", { className: "rowBoxLine" })] }, n)), e.jsx(S, { className: "tableMobileDrawer", open: H, placement: "bottom", height: "auto", closable: !1, onClose: b, children: e.jsxs("div", { className: "drawerBox", children: [e.jsx("div", { className: "boxBody", children: C.map((s, n) => e.jsx("div", { className: "operaList", onClick: () => {
91
- Q(s);
92
- }, children: s.label }, n)) }), e.jsx("div", { className: "boxLine" }), e.jsx("div", { className: "boxFooter", onClick: b, children: E })] }) })] }) }), !x && e.jsx(le, { data: l, title: K, img: A })] })] });
93
- };
90
+ }, active: !0 }) }), e.jsx("div", { className: "rowBoxLine" })] }, n)), e.jsx(S, { className: "tableMobileDrawer", open: H, placement: "bottom", height: "auto", closable: !1, onClose: g, children: e.jsxs("div", { className: "drawerBox", children: [e.jsx("div", { className: "boxBody", children: C.map((s, n) => e.jsx("div", { className: "operaList", onClick: () => {
91
+ J(s);
92
+ }, children: s.label }, n)) }), e.jsx("div", { className: "boxLine" }), e.jsx("div", { className: "boxFooter", onClick: g, children: E })] }) })] }) }), !x && e.jsx(le, { data: l, title: K, img: A })] })] });
93
+ }, Te = (h) => (
94
+ // @ts-ignore
95
+ e.jsx(oe, { initValue: h, children: e.jsx(xe, { ...h }) })
96
+ );
94
97
  export {
95
- ze as default
98
+ Te as default
96
99
  };
@@ -1,27 +1,26 @@
1
- import { j as m } from "../../node_modules/react/jsx-runtime.mjs";
2
- import w from "../../node_modules/ahooks/es/useSize/index.mjs";
3
- import { Space as z, Dropdown as C } from "antd";
4
- import { useRef as N, useMemo as t } from "react";
5
- import x from "../BitzButton/index.mjs";
6
- import g from "./style.mjs";
7
- const S = ({ size: h, actionGroup: e, refInstance: i }) => {
8
- {
9
- const { wrapSSR: n, editBtnClassName: f, delBtnClassName: r, dropdownBtnClassName: l } = g(h), d = t(() => e != null && e.length ? e.slice(0, 1) : [], [e]), B = t(() => (e == null ? void 0 : e.length) > 1 ? e.slice(1, 2) : [], [e]), c = t(() => (e == null ? void 0 : e.length) > 2 ? [{ label: "更多" }] : [], [e]), j = t(() => (e == null ? void 0 : e.length) > 2 ? e.slice(2, e.length) : [], [e]);
10
- return n(m.jsxs(z, { size: 24, ref: i, children: [d.map((s) => m.jsx(x, { type: "text", className: f, onClick: s == null ? void 0 : s.onClick, children: s == null ? void 0 : s.label }, 1)), B.map((s) => m.jsx(x, { type: "text", className: r, onClick: s == null ? void 0 : s.onClick, children: s == null ? void 0 : s.label }, 2)), c.map((s) => m.jsx(C, { menu: { items: j }, children: m.jsx(x, { type: "text", className: l, children: s == null ? void 0 : s.label }, 3) }, 5))] }));
11
- }
1
+ import { j as t } from "../../node_modules/react/jsx-runtime.mjs";
2
+ import o from "../../node_modules/ahooks/es/useSize/index.mjs";
3
+ import { Flex as N, Space as C, Skeleton as k, Dropdown as y } from "antd";
4
+ import { useContext as w, useRef as R, useMemo as m } from "react";
5
+ import j from "../BitzButton/index.mjs";
6
+ import { TableContext as z } from "../BitzTableProvider/index.mjs";
7
+ import B from "./style.mjs";
8
+ const T = ({ actionGroup: e, refInstance: f }) => {
9
+ const { tableSize: l = "lg" } = w(z), { gap: h, wrapSSR: a } = B(l), { editBtnClassName: d, delBtnClassName: i, dropdownBtnClassName: g } = B(l), n = m(() => e != null && e.length ? e.slice(0, 1) : [], [e]), r = m(() => (e == null ? void 0 : e.length) > 1 ? e.slice(1, 2) : [], [e]), x = m(() => (e == null ? void 0 : e.length) > 2 ? [{ label: "更多" }] : [], [e]), c = m(() => (e == null ? void 0 : e.length) > 2 ? e.slice(2, e.length) : [], [e]);
10
+ return a(t.jsxs(C, { size: h, ref: f, children: [n.map((s) => t.jsx(j, { type: "text", className: d, onClick: s == null ? void 0 : s.onClick, children: s == null ? void 0 : s.label }, 1)), r.map((s) => t.jsx(j, { type: "text", className: i, onClick: s == null ? void 0 : s.onClick, children: s == null ? void 0 : s.label }, 2)), x.map((s) => t.jsx(y, { menu: { items: c }, children: t.jsx(j, { type: "text", className: g, children: s == null ? void 0 : s.label }, 3) }, 5))] }));
12
11
  };
13
- function k(h) {
14
- return (e) => {
15
- const { size: i, actionGroup: n, ...f } = e, r = N(null), l = w(r), d = t(() => l != null && l.width ? l.width + 48 + 1 : 200, [l]);
16
- return t(() => ({
17
- width: d,
18
- render: () => m.jsx(h, { size: i, actionGroup: n, refInstance: r }),
19
- ...f
20
- }), [d]);
12
+ function A(e) {
13
+ return (f) => {
14
+ const { actionGroup: l, loading: h, ...a } = f, { tableSize: d = "lg" } = w(z), { gap: i, sizeMap: g } = B(d), n = R(null), r = o(n), x = m(() => r != null && r.width ? r.width + i * 2 + 1 : 181, [r, i]), c = m(() => h ? t.jsx(N, { children: t.jsx(C, { size: i, ref: n, children: l == null ? void 0 : l.slice(0, l.length >= 3 ? 3 : l.length).map((v, S) => t.jsx(k, { active: !0, title: !1, paragraph: { rows: 1, width: g[d] * 2 } }, S)) }) }) : t.jsx(e, { actionGroup: l, refInstance: n }), [h, n, d, l]);
15
+ return m(() => ({
16
+ width: x,
17
+ render: () => c,
18
+ ...a
19
+ }), [x, c]);
21
20
  };
22
21
  }
23
- const E = k(S);
22
+ const H = A(T);
24
23
  export {
25
- S as BitzTableAction,
26
- E as default
24
+ T as BitzTableAction,
25
+ H as default
27
26
  };
@@ -1,7 +1,7 @@
1
- import { useContext as C, useMemo as v } from "react";
2
- import { theme as w } from "antd";
1
+ import { theme as v } from "antd";
3
2
  import "../../node_modules/@ant-design/cssinjs/es/extractStyle.mjs";
4
3
  import "../../node_modules/@ant-design/cssinjs/es/hooks/useCacheToken.mjs";
4
+ import "react";
5
5
  import "../../node_modules/@ant-design/cssinjs/es/StyleContext.mjs";
6
6
  import "../../node_modules/@ant-design/cssinjs/es/theme/createTheme.mjs";
7
7
  import "../../node_modules/rc-util/es/warning.mjs";
@@ -9,12 +9,17 @@ import "../../node_modules/@ant-design/cssinjs/es/theme/ThemeCache.mjs";
9
9
  import "../../node_modules/@ant-design/cssinjs/es/hooks/useCompatibleInsertionEffect.mjs";
10
10
  import "../../node_modules/@ant-design/cssinjs/es/hooks/useEffectCleanupRegister.mjs";
11
11
  import "../../node_modules/@ant-design/cssinjs/es/hooks/useHMR.mjs";
12
- import x from "../../node_modules/@ant-design/cssinjs/es/hooks/useStyleRegister.mjs";
12
+ import b from "../../node_modules/@ant-design/cssinjs/es/hooks/useStyleRegister.mjs";
13
13
  import "../../node_modules/@ant-design/cssinjs/es/transformers/legacyLogicalProperties.mjs";
14
- import { TableContext as T } from "../BitzTableProvider/index.mjs";
15
- import a from "../../node_modules/classnames/index.mjs";
16
- const K = (p) => {
17
- const { theme: g, hashId: e, token: n } = w.useToken(), { tableSize: d } = C(T), h = v(() => p ?? d ?? "lg", [p, d]), i = "ActionTextBtn", r = "actionTextBtn", m = "editBtn", s = "delBtn", c = "dropdownBtn", S = (t, o) => [
14
+ import p from "../../node_modules/classnames/index.mjs";
15
+ const j = (d) => {
16
+ const { theme: g, hashId: e, token: s } = v.useToken(), i = "ActionTextBtn", n = "actionTextBtn", m = "editBtn", l = "delBtn", c = "dropdownBtn", r = {
17
+ xl: 14,
18
+ lg: 12,
19
+ md: 12,
20
+ sm: 11,
21
+ xs: 11
22
+ }, h = 24, B = (t, o) => [
18
23
  {
19
24
  [`.${t}`]: {
20
25
  padding: 0,
@@ -27,12 +32,12 @@ const K = (p) => {
27
32
  }
28
33
  }
29
34
  },
30
- { [`.xl${o}`]: { fontSize: 14 } },
31
- { [`.lg${o}`]: { fontSize: 12 } },
32
- { [`.md${o}`]: { fontSize: 12 } },
33
- { [`.sm${o}`]: { fontSize: 11 } },
34
- { [`.xs${o}`]: { fontSize: 11 } }
35
- ], B = (t, o) => [
35
+ { [`.xl${o}`]: { fontSize: r.xl } },
36
+ { [`.lg${o}`]: { fontSize: r.lg } },
37
+ { [`.md${o}`]: { fontSize: r.md } },
38
+ { [`.sm${o}`]: { fontSize: r.sm } },
39
+ { [`.xs${o}`]: { fontSize: r.xs } }
40
+ ], $ = (t, o) => [
36
41
  {
37
42
  [`.${t}`]: {
38
43
  color: o.colorPrimary,
@@ -41,7 +46,7 @@ const K = (p) => {
41
46
  }
42
47
  }
43
48
  }
44
- ], $ = (t, o) => [
49
+ ], S = (t, o) => [
45
50
  {
46
51
  [`.${t}`]: {
47
52
  color: o.colorError,
@@ -62,19 +67,19 @@ const K = (p) => {
62
67
  }
63
68
  }
64
69
  }
65
- ], f = x({
70
+ ], y = b({
66
71
  theme: g,
67
- token: n,
72
+ token: s,
68
73
  hashId: e,
69
- path: [r, i, m, s, c]
74
+ path: [n, i, m, l, c]
70
75
  }, () => [
71
- S(r, i),
72
- B(m, n),
73
- $(s, n),
74
- u(c, n)
75
- ]), l = `${h}${i}`, y = a(r, m, l, e), b = a(r, s, l, e), z = a(r, c, l, e);
76
- return { wrapSSR: f, editBtnClassName: y, delBtnClassName: b, dropdownBtnClassName: z };
76
+ B(n, i),
77
+ $(m, s),
78
+ S(l, s),
79
+ u(c, s)
80
+ ]), a = `${d}${i}`, x = p(n, m, a, e), z = p(n, l, a, e), f = p(n, c, a, e);
81
+ return { sizeMap: r, gap: h, wrapSSR: y, editBtnClassName: x, delBtnClassName: z, dropdownBtnClassName: f };
77
82
  };
78
83
  export {
79
- K as default
84
+ j as default
80
85
  };
@@ -1,27 +1,27 @@
1
- import { j as O } from "../../node_modules/react/jsx-runtime.mjs";
1
+ import { j as N } from "../../node_modules/react/jsx-runtime.mjs";
2
2
  import T from "../../hooks/useMergedState.mjs";
3
- import { createContext as b, useRef as J, useMemo as N, useEffect as v, useCallback as j } from "react";
4
- import { genColumnKey as I } from "./utils/index.mjs";
3
+ import { createContext as j, useRef as I, useMemo as E, useState as P, useEffect as v, useCallback as L } from "react";
4
+ import { genColumnKey as R } from "./utils/index.mjs";
5
5
  import M from "../../node_modules/lodash-es/merge.mjs";
6
- function E(e = {}) {
6
+ function k(e = {}) {
7
7
  var y, w, C, K, h, g;
8
- const o = J([]), [x, z] = T(() => e.size || e.defaultSize || "lg", {
8
+ const o = I([]), { defaultSize: x = "lg" } = e, [z, O] = T(() => e.size ?? x, {
9
9
  value: e.size,
10
10
  onChange: e.onSizeChange
11
- }), m = N(() => {
11
+ }), m = E(() => {
12
12
  var u, t;
13
13
  if ((u = e == null ? void 0 : e.columnsState) != null && u.defaultValue)
14
14
  return e.columnsState.defaultValue;
15
15
  const n = {};
16
16
  return (t = e.columns) == null || t.forEach(({ key: c, dataIndex: l, fixed: a, disable: i }, s) => {
17
- const V = I(c ?? l, s);
17
+ const V = R(c ?? l, s);
18
18
  V && (n[V] = {
19
19
  show: !0,
20
20
  fixed: a,
21
21
  disable: i
22
22
  });
23
23
  }), n;
24
- }, [e.columns]), [f, r] = T(() => {
24
+ }, [e.columns]), [b, J] = P({}), [f, r] = T(() => {
25
25
  var t, c, l, a;
26
26
  const { persistenceType: n, persistenceKey: u } = e.columnsState || {};
27
27
  if (u && n && typeof window < "u") {
@@ -56,7 +56,7 @@ function E(e = {}) {
56
56
  (K = e.columnsState) == null ? void 0 : K.persistenceType,
57
57
  m
58
58
  ]);
59
- const S = j(() => {
59
+ const S = L(() => {
60
60
  const { persistenceType: n, persistenceKey: u } = e.columnsState || {};
61
61
  if (!u || !n || typeof window > "u")
62
62
  return;
@@ -87,10 +87,12 @@ function E(e = {}) {
87
87
  setSortKeyColumns: (n) => {
88
88
  o.current = n;
89
89
  },
90
+ columnList: b,
91
+ setColumnList: J,
90
92
  columnsMap: f,
91
93
  setColumnsMap: r,
92
- setTableSize: z,
93
- tableSize: x,
94
+ setTableSize: O,
95
+ tableSize: z,
94
96
  columns: e.columns,
95
97
  clearPersistenceStorage: S,
96
98
  defaultColumnKeyMap: m
@@ -99,11 +101,11 @@ function E(e = {}) {
99
101
  get: () => o.current
100
102
  }), d;
101
103
  }
102
- const P = b({}), D = (e) => {
103
- const o = E(e.initValue);
104
- return O.jsx(P.Provider, { value: o, children: e.children });
104
+ const q = j({}), H = (e) => {
105
+ const o = k(e.initValue);
106
+ return N.jsx(q.Provider, { value: o, children: e.children });
105
107
  };
106
108
  export {
107
- P as TableContext,
108
- D as default
109
+ q as TableContext,
110
+ H as default
109
111
  };
@@ -1,90 +1,94 @@
1
1
  import { j as s } from "../../../node_modules/react/jsx-runtime.mjs";
2
- import { create as V, useModal as W, antdModalV5 as q } from "@ebay/nice-modal-react";
3
- import { Modal as z, Checkbox as G } from "antd";
4
- import o from "./index.module.less.mjs";
5
- import { useState as H, useContext as J, useCallback as A, useMemo as p } from "react";
6
- import { TableContext as Q } from "../../BitzTableProvider/index.mjs";
7
- import { genColumnKey as w, columnSort as U } from "../../BitzTableProvider/utils/index.mjs";
8
- import I from "../../../node_modules/classnames/index.mjs";
9
- import { DndContext as X, DragOverlay as Y, defaultDropAnimationSideEffects as Z } from "../../../node_modules/@dnd-kit/core/dist/core.esm.mjs";
10
- import { SortableContext as _, verticalListSortingStrategy as $, arrayMove as L } from "../../../node_modules/@dnd-kit/sortable/dist/sortable.esm.mjs";
11
- import P from "./DndItem.mjs";
12
- import { restrictToVerticalAxis as ee, restrictToWindowEdges as se } from "../../../node_modules/@dnd-kit/modifiers/dist/modifiers.esm.mjs";
13
- import B from "../../../node_modules/lodash-es/omit.mjs";
14
- import le from "../../../node_modules/@ant-design/icons/es/icons/RedoOutlined.mjs";
15
- import te from "../../../node_modules/@ant-design/icons/es/icons/DragOutlined.mjs";
16
- const oe = {
17
- sideEffects: Z({
2
+ import { create as G, useModal as H, antdModalV5 as J } from "@ebay/nice-modal-react";
3
+ import { Modal as P, Checkbox as Q } from "antd";
4
+ import t from "./index.module.less.mjs";
5
+ import { useState as U, useContext as X, useCallback as I, useMemo as j } from "react";
6
+ import { TableContext as Y } from "../../BitzTableProvider/index.mjs";
7
+ import { genColumnKey as B, columnSort as Z } from "../../BitzTableProvider/utils/index.mjs";
8
+ import g from "../../../node_modules/classnames/index.mjs";
9
+ import { DndContext as _, DragOverlay as $, defaultDropAnimationSideEffects as ee } from "../../../node_modules/@dnd-kit/core/dist/core.esm.mjs";
10
+ import { SortableContext as se, verticalListSortingStrategy as le, arrayMove as oe } from "../../../node_modules/@dnd-kit/sortable/dist/sortable.esm.mjs";
11
+ import te from "./DndItem.mjs";
12
+ import { restrictToVerticalAxis as ne, restrictToWindowEdges as ae } from "../../../node_modules/@dnd-kit/modifiers/dist/modifiers.esm.mjs";
13
+ import K from "../../../node_modules/lodash-es/omit.mjs";
14
+ import ce from "../../../node_modules/@ant-design/icons/es/icons/RedoOutlined.mjs";
15
+ import ie from "../../../node_modules/@ant-design/icons/es/icons/DragOutlined.mjs";
16
+ const de = {
17
+ sideEffects: ee({
18
18
  styles: {
19
19
  active: {
20
20
  opacity: "0.5"
21
21
  }
22
22
  }
23
23
  })
24
- }, ye = V(() => {
25
- var C;
26
- const g = W(), [u, j] = H(null), { columnsMap: r, setColumnsMap: b, sortKeyColumns: x, setSortKeyColumns: K, clearPersistenceStorage: v, ...t } = J(Q), F = A(() => {
27
- v == null || v(), b(t.defaultColumnKeyMap);
28
- }, []), h = p(() => {
29
- var l, a;
24
+ }, De = G(() => {
25
+ var S;
26
+ const v = H(), C = J(v), [u, b] = U(null), { columnList: F, setColumnList: O, columnsMap: i, setColumnsMap: p, sortKeyColumns: x, setSortKeyColumns: T, clearPersistenceStorage: y, ...o } = X(Y), R = I(() => {
27
+ y == null || y(), p(o.defaultColumnKeyMap);
28
+ }, []), h = j(() => {
29
+ var l, n;
30
30
  const e = [];
31
- return (l = t == null ? void 0 : t.columns) != null && l.length && ((a = t == null ? void 0 : t.columns) == null || a.map(({ key: m, dataIndex: n, ...i }) => {
32
- const f = w(m || n, [m || n].filter(Boolean).join("-")), d = r[f || "null"];
33
- return (d == null ? void 0 : d.show) !== !1 && e.push({
31
+ return (l = o == null ? void 0 : o.columns) != null && l.length && ((n = o == null ? void 0 : o.columns) == null || n.map(({ key: m, dataIndex: a, ...d }) => {
32
+ const f = B(m || a, [m || a].filter(Boolean).join("-")), r = i[f || "null"];
33
+ return (r == null ? void 0 : r.show) !== !1 && e.push({
34
34
  key: f,
35
- ...B(i, ["className"]),
35
+ ...K(d, ["className"]),
36
36
  selectable: !1,
37
- disabled: (d == null ? void 0 : d.disable) === !0
38
- }), d;
39
- })), e.sort(U(r));
40
- }, [r, t == null ? void 0 : t.columns]), y = A((e) => x == null ? void 0 : x.findIndex((l) => l === e), [x]), k = p(() => u ? y(u) : -1, [u, y]), E = p(() => {
37
+ disabled: (r == null ? void 0 : r.disable) === !0
38
+ }), r;
39
+ })), e.sort(Z(i));
40
+ }, [i, o == null ? void 0 : o.columns]), k = I((e) => x == null ? void 0 : x.findIndex((l) => l === e), [x]), E = j(() => u ? k(u) : -1, [u, k]), D = j(() => {
41
41
  const e = [], l = /* @__PURE__ */ new Map();
42
- return { list: ((m, n) => m.map(({ key: i, dataIndex: f, children: d, ...D }) => {
43
- var M;
44
- const N = w(i || f, [n == null ? void 0 : n.columnKey, D.index].filter(Boolean).join("-")), c = r[N || "null"] || { show: !0 };
45
- (c == null ? void 0 : c.show) !== !1 && !d && e.push(N);
46
- const S = {
42
+ return { list: ((m, a) => m.map(({ key: d, dataIndex: f, children: r, ...M }) => {
43
+ var w;
44
+ const N = B(d || f, [a == null ? void 0 : a.columnKey, M.index].filter(Boolean).join("-")), c = i[N || "null"] || { show: !0 };
45
+ (c == null ? void 0 : c.show) !== !1 && !r && e.push(N);
46
+ const A = {
47
47
  key: N,
48
- ...B(D, ["className"]),
48
+ ...K(M, ["className"]),
49
49
  selectable: !1,
50
50
  disabled: c.disable === !0,
51
- disableCheckbox: typeof c.disable == "boolean" ? c == null ? void 0 : c.disable : (M = c == null ? void 0 : c.disable) == null ? void 0 : M.checkbox,
52
- isLeaf: n ? !0 : void 0
51
+ disableCheckbox: typeof c.disable == "boolean" ? c == null ? void 0 : c.disable : (w = c == null ? void 0 : c.disable) == null ? void 0 : w.checkbox,
52
+ isLeaf: a ? !0 : void 0
53
53
  };
54
- return l.set(i, S), S;
55
- }))(t == null ? void 0 : t.columns), keys: e, map: l };
56
- }, [r, t == null ? void 0 : t.columns]), O = (e, l) => {
57
- const a = { ...r };
58
- ((n) => {
59
- const i = { ...a[n] };
60
- i.show = !e, a[n] = i;
61
- })(l.key), b({ ...a });
62
- }, T = (e, l) => {
63
- const a = { ...r }, m = L(x, e, l);
64
- m.forEach((n, i) => {
65
- a[n] = { ...a[n] || {}, order: i };
66
- }), b(a), K(m);
67
- }, R = p(() => {
54
+ return l.set(d, A), A;
55
+ }))(o == null ? void 0 : o.columns), keys: e, map: l };
56
+ }, [i, o == null ? void 0 : o.columns]), V = (e, l) => {
57
+ const n = { ...i };
58
+ ((a) => {
59
+ const d = { ...n[a] };
60
+ d.show = !e, n[a] = d;
61
+ })(l.key), p({ ...n });
62
+ }, L = (e, l) => {
63
+ const n = { ...i }, m = oe(x, e, l);
64
+ m.forEach((a, d) => {
65
+ n[a] = { ...n[a] || {}, order: d };
66
+ }), p(n), T(m);
67
+ }, W = j(() => {
68
68
  var e, l;
69
- return u ? ((l = (e = t == null ? void 0 : t.columns) == null ? void 0 : e.find((a) => a.key === u)) == null ? void 0 : l.title) ?? "" : "";
70
- }, [t == null ? void 0 : t.columns, u, r, x]);
71
- return s.jsxs(z, { title: "自定义列", ...q(g), width: 600, footer: !1, children: [s.jsx("div", { className: o.introduce, children: "选择要在表中显示的可用列。拖动选定的列以对其重新排序。" }), s.jsxs("div", { className: o.contaiern, children: [s.jsxs("div", { className: o.block, children: [s.jsxs("div", { className: o.header, children: [s.jsx("div", { className: o.title, children: "可用列" }), s.jsx("div", {})] }), s.jsx("div", { className: o.body, children: s.jsx("ul", { className: o.content, children: (C = E.list) == null ? void 0 : C.map((e) => {
72
- const l = E.keys.includes(e.key);
73
- return s.jsxs("li", { className: I(o.item, {
74
- [o.checked]: !l
75
- }), onClick: () => !e.disabled && O(l, e), children: [s.jsx(G, { checked: l, disabled: e.disabled }), s.jsx("span", { className: o["content-item-text"], children: e.title })] }, e.key);
76
- }) }) })] }), s.jsxs("div", { className: o.block, children: [s.jsxs("div", { className: o.header, children: [s.jsx("div", { className: o.title, children: "选定的列" }), s.jsxs("div", { className: o.reset, onClick: F, children: [s.jsx("div", { children: "重置  " }), s.jsx(le, {})] })] }), s.jsx("div", { className: o.body, children: s.jsxs(X, { modifiers: [ee, se], onDragStart: (e) => {
69
+ return u ? ((l = (e = o == null ? void 0 : o.columns) == null ? void 0 : e.find((n) => n.key === u)) == null ? void 0 : l.title) ?? "" : "";
70
+ }, [o == null ? void 0 : o.columns, u, i, x]), q = () => {
71
+ O({ ...i }), v.resolve({ ...i }), v.hide();
72
+ }, z = () => {
73
+ p({ ...F }), C.onCancel();
74
+ };
75
+ return s.jsxs(P, { title: "自定义列", ...C, width: 600, onOk: q, onCancel: z, children: [s.jsx("div", { className: t.introduce, children: "选择要在表中显示的可用列。拖动选定的列以对其重新排序。" }), s.jsxs("div", { className: t.contaiern, children: [s.jsxs("div", { className: t.block, children: [s.jsxs("div", { className: t.header, children: [s.jsx("div", { className: t.title, children: "可用列" }), s.jsx("div", {})] }), s.jsx("div", { className: t.body, children: s.jsx("ul", { className: t.content, children: (S = D.list) == null ? void 0 : S.map((e) => {
76
+ const l = D.keys.includes(e.key);
77
+ return s.jsxs("li", { className: g(t.item, {
78
+ [t.checked]: !l
79
+ }), onClick: () => !e.disabled && V(l, e), children: [s.jsx(Q, { checked: l, disabled: e.disabled }), s.jsx("span", { className: t["content-item-text"], children: e.title })] }, e.key);
80
+ }) }) })] }), s.jsxs("div", { className: t.block, children: [s.jsxs("div", { className: t.header, children: [s.jsx("div", { className: t.title, children: "选定的列" }), s.jsxs("div", { className: t.reset, onClick: R, children: [s.jsx("div", { children: "重置  " }), s.jsx(ce, {})] })] }), s.jsx("div", { className: t.body, children: s.jsxs(_, { modifiers: [ne, ae], onDragStart: (e) => {
77
81
  const { active: l } = e;
78
- l && j(l == null ? void 0 : l.id);
79
- }, onDragCancel: () => j(null), onDragEnd: (e) => {
80
- j(null);
82
+ l && b(l == null ? void 0 : l.id);
83
+ }, onDragCancel: () => b(null), onDragEnd: (e) => {
84
+ b(null);
81
85
  const { over: l } = e;
82
86
  if (l) {
83
- const a = y(l.id);
84
- k !== a && T(k, a);
87
+ const n = k(l.id);
88
+ E !== n && L(E, n);
85
89
  }
86
- }, children: [s.jsx(_, { items: h == null ? void 0 : h.map((e) => e.key), strategy: $, children: s.jsx("ul", { className: o.content, style: { background: "#fff" }, children: h == null ? void 0 : h.map((e) => s.jsx(P, { item: e }, e.key)) }) }), s.jsx(Y, { adjustScale: !1, dropAnimation: oe, children: u ? s.jsxs("li", { className: I(o.moveItem), children: [s.jsx(te, { className: o.dragIcon }), s.jsx("span", { className: o["moveItem-text"], children: R })] }) : null })] }) })] })] })] });
90
+ }, children: [s.jsx(se, { items: h == null ? void 0 : h.map((e) => e.key), strategy: le, children: s.jsx("ul", { className: t.content, style: { background: "#fff" }, children: h == null ? void 0 : h.map((e) => s.jsx(te, { item: e }, e.key)) }) }), s.jsx($, { adjustScale: !1, dropAnimation: de, children: u ? s.jsxs("li", { className: g(t.moveItem), children: [s.jsx(ie, { className: t.dragIcon }), s.jsx("span", { className: t["moveItem-text"], children: W })] }) : null })] }) })] })] })] });
87
91
  });
88
92
  export {
89
- ye as default
93
+ De as default
90
94
  };