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.
- package/README.md +2 -2
- package/dist/components/BitzPagination/index.mjs +17 -16
- package/dist/components/BitzTable/TableSkeleton/index.mjs +11 -14
- package/dist/components/BitzTable/index.mjs +44 -41
- package/dist/components/BitzTableActionCol/index.mjs +21 -22
- package/dist/components/BitzTableActionCol/style.mjs +29 -24
- package/dist/components/BitzTableProvider/index.mjs +18 -16
- package/dist/components/BitzTableToolBar/ColumnSetting/ColumnSettingModal.mjs +71 -67
- package/dist/components/BitzTableToolBar/ColumnSetting/index.mjs +17 -14
- package/dist/components/BitzTableToolBar/DensityIcon/index.mjs +17 -16
- package/dist/components/BitzTableToolBar/ExportIcon/index.mjs +15 -10
- package/dist/components/BitzTableToolBar/RefreshIcon/index.mjs +11 -12
- package/dist/components/BitzTableToolBar/Wrapper/index.mjs +10 -10
- package/dist/components/BitzTableToolBar/index.mjs +8 -6
- package/dist/components/BitzTableToolBar/style.mjs +13 -10
- package/dist/style.css +1 -1
- package/dist/type/components/BitzTable/index.d.ts +2 -2
- package/dist/type/components/BitzTableActionCol/index.d.ts +2 -3
- package/dist/type/components/BitzTableActionCol/style.d.ts +8 -0
- package/dist/type/components/BitzTableProvider/index.d.ts +4 -0
- package/dist/type/components/BitzTableToolBar/ColumnSetting/index.d.ts +5 -1
- package/dist/type/components/BitzTableToolBar/DensityIcon/index.d.ts +5 -2
- package/dist/type/components/BitzTableToolBar/ExportIcon/index.d.ts +1 -2
- package/dist/type/components/BitzTableToolBar/Wrapper/index.d.ts +14 -2
- package/dist/type/pages/Login2/index.d.ts +2 -0
- package/dist/type/pages/Login3/index.d.ts +2 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,26 +1,27 @@
|
|
|
1
|
-
import { j as
|
|
2
|
-
import { useState as m, useMemo as x, useEffect as
|
|
3
|
-
import { Pagination as
|
|
4
|
-
import { isMobile as
|
|
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
|
|
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 [
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}, [
|
|
13
|
-
const j = (e,
|
|
14
|
-
s(e), r &&
|
|
15
|
-
}, w = (e,
|
|
16
|
-
r = !1, C(
|
|
17
|
-
s(1),
|
|
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
|
|
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
|
-
|
|
26
|
+
R as default
|
|
26
27
|
};
|
|
@@ -1,21 +1,18 @@
|
|
|
1
|
-
import { j as
|
|
2
|
-
import { Skeleton as
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
length:
|
|
6
|
-
}).map((
|
|
7
|
-
...
|
|
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: (
|
|
9
|
+
render: (a, l, f) => o.jsx(n, { active: !0, title: !1, paragraph: {
|
|
13
10
|
rows: 1,
|
|
14
|
-
width: (
|
|
11
|
+
width: (f + 1) % 2 === 0 ? "100%" : "60%"
|
|
15
12
|
} })
|
|
16
13
|
});
|
|
17
|
-
return
|
|
14
|
+
return o.jsx(p, { columns: i, rowKey: "index", dataSource: s });
|
|
18
15
|
};
|
|
19
16
|
export {
|
|
20
|
-
|
|
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
|
|
3
|
-
import { isMobile as
|
|
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
|
|
10
|
+
import oe, { TableContext as ie } from "../BitzTableProvider/index.mjs";
|
|
11
11
|
import re from "./TableSkeleton/index.mjs";
|
|
12
|
-
import { columnSort as
|
|
12
|
+
import { columnSort as te, genColumnKey as N } from "../BitzTableProvider/utils/index.mjs";
|
|
13
13
|
import "./index.less.mjs";
|
|
14
|
-
import
|
|
15
|
-
const
|
|
16
|
-
tableItemEmit:
|
|
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:
|
|
20
|
+
total: d = 0,
|
|
21
21
|
columns: t,
|
|
22
22
|
loading: x = !1,
|
|
23
23
|
skeletonNum: z = 2,
|
|
24
|
-
skeletonRender:
|
|
25
|
-
skeletonRowNum:
|
|
24
|
+
skeletonRender: j,
|
|
25
|
+
skeletonRowNum: L = 4,
|
|
26
26
|
skeletonRowsWidth: T = ["35%", "100%", "100%", "60%"],
|
|
27
27
|
tableOperationEmit: u = () => {
|
|
28
28
|
},
|
|
29
|
-
mobileLoadEmit:
|
|
29
|
+
mobileLoadEmit: M = () => {
|
|
30
30
|
},
|
|
31
|
-
mobileRefreshEmit:
|
|
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:
|
|
43
|
-
pagination:
|
|
42
|
+
size: b,
|
|
43
|
+
pagination: ce = !1,
|
|
44
44
|
showTableTool: O = !0,
|
|
45
|
-
tableAction:
|
|
46
|
-
tableToolbar:
|
|
45
|
+
tableAction: P,
|
|
46
|
+
tableToolbar: $,
|
|
47
47
|
resetPage: _,
|
|
48
48
|
...a
|
|
49
49
|
}) => {
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
},
|
|
53
|
-
|
|
54
|
-
},
|
|
55
|
-
|
|
56
|
-
}, c =
|
|
57
|
-
const s = (
|
|
58
|
-
const
|
|
59
|
-
return
|
|
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(
|
|
65
|
-
}, [
|
|
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
|
-
|
|
77
|
+
N((n == null ? void 0 : n.key) ?? (n == null ? void 0 : n.dataIndex), n == null ? void 0 : n.dataIndex)
|
|
78
78
|
));
|
|
79
|
-
|
|
79
|
+
r.setSortKeyColumns(s);
|
|
80
80
|
}
|
|
81
81
|
}, [t]);
|
|
82
|
-
const
|
|
83
|
-
return e.jsxs("div", { className: "bitzTableBlock", children: [!
|
|
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:
|
|
86
|
-
|
|
87
|
-
}, children: [e.jsxs("div", { className: "label", children: [
|
|
88
|
-
rows:
|
|
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:
|
|
91
|
-
|
|
92
|
-
}, children: s.label }, n)) }), e.jsx("div", { className: "boxLine" }), e.jsx("div", { className: "boxFooter", onClick:
|
|
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
|
-
|
|
98
|
+
Te as default
|
|
96
99
|
};
|
|
@@ -1,27 +1,26 @@
|
|
|
1
|
-
import { j as
|
|
2
|
-
import
|
|
3
|
-
import { Space as
|
|
4
|
-
import { useRef as
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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
|
|
14
|
-
return (
|
|
15
|
-
const {
|
|
16
|
-
return
|
|
17
|
-
width:
|
|
18
|
-
render: () =>
|
|
19
|
-
...
|
|
20
|
-
}), [
|
|
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
|
|
22
|
+
const H = A(T);
|
|
24
23
|
export {
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
T as BitzTableAction,
|
|
25
|
+
H as default
|
|
27
26
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
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
|
|
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
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
|
|
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:
|
|
31
|
-
{ [`.lg${o}`]: { fontSize:
|
|
32
|
-
{ [`.md${o}`]: { fontSize:
|
|
33
|
-
{ [`.sm${o}`]: { fontSize:
|
|
34
|
-
{ [`.xs${o}`]: { fontSize:
|
|
35
|
-
],
|
|
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
|
-
],
|
|
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
|
-
],
|
|
70
|
+
], y = b({
|
|
66
71
|
theme: g,
|
|
67
|
-
token:
|
|
72
|
+
token: s,
|
|
68
73
|
hashId: e,
|
|
69
|
-
path: [
|
|
74
|
+
path: [n, i, m, l, c]
|
|
70
75
|
}, () => [
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
u(c,
|
|
75
|
-
]),
|
|
76
|
-
return { wrapSSR:
|
|
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
|
-
|
|
84
|
+
j as default
|
|
80
85
|
};
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { j as
|
|
1
|
+
import { j as N } from "../../node_modules/react/jsx-runtime.mjs";
|
|
2
2
|
import T from "../../hooks/useMergedState.mjs";
|
|
3
|
-
import { createContext as
|
|
4
|
-
import { genColumnKey as
|
|
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
|
|
6
|
+
function k(e = {}) {
|
|
7
7
|
var y, w, C, K, h, g;
|
|
8
|
-
const o =
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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:
|
|
93
|
-
tableSize:
|
|
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
|
|
103
|
-
const o =
|
|
104
|
-
return
|
|
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
|
-
|
|
108
|
-
|
|
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
|
|
3
|
-
import { Modal as
|
|
4
|
-
import
|
|
5
|
-
import { useState as
|
|
6
|
-
import { TableContext as
|
|
7
|
-
import { genColumnKey as
|
|
8
|
-
import
|
|
9
|
-
import { DndContext as
|
|
10
|
-
import { SortableContext as
|
|
11
|
-
import
|
|
12
|
-
import { restrictToVerticalAxis as
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
const
|
|
17
|
-
sideEffects:
|
|
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
|
-
},
|
|
25
|
-
var
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
}, []), h =
|
|
29
|
-
var l,
|
|
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 =
|
|
32
|
-
const f =
|
|
33
|
-
return (
|
|
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
|
-
...
|
|
35
|
+
...K(d, ["className"]),
|
|
36
36
|
selectable: !1,
|
|
37
|
-
disabled: (
|
|
38
|
-
}),
|
|
39
|
-
})), e.sort(
|
|
40
|
-
}, [
|
|
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,
|
|
43
|
-
var
|
|
44
|
-
const N =
|
|
45
|
-
(c == null ? void 0 : c.show) !== !1 && !
|
|
46
|
-
const
|
|
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
|
-
...
|
|
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 : (
|
|
52
|
-
isLeaf:
|
|
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(
|
|
55
|
-
}))(
|
|
56
|
-
}, [
|
|
57
|
-
const
|
|
58
|
-
((
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
})(l.key),
|
|
62
|
-
},
|
|
63
|
-
const
|
|
64
|
-
m.forEach((
|
|
65
|
-
a
|
|
66
|
-
}),
|
|
67
|
-
},
|
|
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 =
|
|
70
|
-
}, [
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
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 &&
|
|
79
|
-
}, onDragCancel: () =>
|
|
80
|
-
|
|
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
|
|
84
|
-
|
|
87
|
+
const n = k(l.id);
|
|
88
|
+
E !== n && L(E, n);
|
|
85
89
|
}
|
|
86
|
-
}, children: [s.jsx(
|
|
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
|
-
|
|
93
|
+
De as default
|
|
90
94
|
};
|