bitz-react-admin-ui 1.6.6 → 1.6.8
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/dist/bitz-ui.mjs +126 -120
- package/dist/components/BitzFluentInput/index.mjs +17 -14
- package/dist/components/BitzFluentSelect/index.mjs +17 -15
- package/dist/components/BitzList/List.mjs +14 -0
- package/dist/components/BitzList/LoadMore.mjs +60 -0
- package/dist/components/BitzList/index.less.mjs +4 -0
- package/dist/components/BitzList/index.mjs +6 -0
- package/dist/components/BitzPullRefresh/PullRefresh.mjs +84 -0
- package/dist/components/BitzPullRefresh/index.mjs +6 -0
- package/dist/components/BitzPullRefresh/style/index.less.mjs +4 -0
- package/dist/components/BitzSelect/component/BitzSelectMobile.mjs +86 -74
- package/dist/components/BitzTable/ActionBar/ActionBar.mjs +36 -0
- package/dist/components/BitzTable/ActionBar/Button.mjs +10 -0
- package/dist/components/BitzTable/ActionBar/index.mjs +6 -34
- package/dist/components/BitzTable/ActionBar/style.mjs +36 -27
- package/dist/components/BitzTable/ActionCol/index.mjs +18 -17
- package/dist/components/BitzTable/Table/index.mjs +154 -92
- package/dist/components/BitzTable/TableSkeleton/index.mjs +36 -32
- package/dist/components/BitzTable/ToolBar/ColConfigIcon/ColumnSettingModal.mjs +88 -99
- package/dist/components/BitzTable/ToolBar/ColConfigIcon/DndItem.mjs +20 -18
- package/dist/components/BitzTable/ToolBar/ColConfigIcon/index.mjs +8 -8
- package/dist/components/BitzTable/ToolBar/DensityIcon/index.mjs +7 -7
- package/dist/components/BitzTable/ToolBar/ExportIcon/index.mjs +13 -13
- package/dist/components/BitzTable/ToolBar/RefreshIcon/index.mjs +5 -5
- package/dist/components/BitzTable/ToolBar/Wrapper/index.mjs +7 -3
- package/dist/components/BitzTable/ToolBar/style.mjs +29 -20
- package/dist/hooks/use-event-listener.mjs +31 -0
- package/dist/hooks/use-lock-fn.mjs +18 -0
- package/dist/hooks/use-scroll-parent.mjs +32 -0
- package/dist/hooks/use-touch.mjs +33 -0
- package/dist/node_modules/.store/@dnd-kit_core@6.1.0/node_modules/@dnd-kit/core/dist/core.esm.mjs +751 -1050
- package/dist/node_modules/.store/ahooks@3.7.10/node_modules/ahooks/es/useSetState/index.mjs +16 -0
- package/dist/node_modules/.store/ahooks@3.7.10/node_modules/ahooks/es/useThrottleFn/index.mjs +28 -0
- package/dist/node_modules/.store/ahooks@3.7.10/node_modules/ahooks/es/useUpdateEffect/index.mjs +6 -0
- package/dist/node_modules/.store/lodash@4.17.21/node_modules/lodash/_Symbol.mjs +5 -0
- package/dist/node_modules/.store/lodash@4.17.21/node_modules/lodash/_baseGetTag.mjs +11 -0
- package/dist/node_modules/.store/lodash@4.17.21/node_modules/lodash/_baseTrim.mjs +9 -0
- package/dist/node_modules/.store/lodash@4.17.21/node_modules/lodash/_freeGlobal.mjs +5 -0
- package/dist/node_modules/.store/lodash@4.17.21/node_modules/lodash/_getRawTag.mjs +16 -0
- package/dist/node_modules/.store/lodash@4.17.21/node_modules/lodash/_objectToString.mjs +8 -0
- package/dist/node_modules/.store/lodash@4.17.21/node_modules/lodash/_root.mjs +5 -0
- package/dist/node_modules/.store/lodash@4.17.21/node_modules/lodash/_trimmedEndIndex.mjs +10 -0
- package/dist/node_modules/.store/lodash@4.17.21/node_modules/lodash/debounce.mjs +55 -0
- package/dist/node_modules/.store/lodash@4.17.21/node_modules/lodash/isObject.mjs +8 -0
- package/dist/node_modules/.store/lodash@4.17.21/node_modules/lodash/isObjectLike.mjs +7 -0
- package/dist/node_modules/.store/lodash@4.17.21/node_modules/lodash/isSymbol.mjs +10 -0
- package/dist/node_modules/.store/lodash@4.17.21/node_modules/lodash/now.mjs +7 -0
- package/dist/node_modules/.store/lodash@4.17.21/node_modules/lodash/throttle.mjs +19 -0
- package/dist/node_modules/.store/lodash@4.17.21/node_modules/lodash/toNumber.mjs +23 -0
- package/dist/node_modules/.store/tslib@2.6.2/node_modules/tslib/tslib.es6.mjs +48 -37
- package/dist/node_modules/_clsx@2.1.0@clsx/dist/clsx.mjs +23 -0
- package/dist/style.css +1 -1
- package/dist/type/bitz-ui.d.ts +2 -0
- package/dist/type/components/BitzList/List.d.ts +4 -0
- package/dist/type/components/BitzList/LoadMore.d.ts +4 -0
- package/dist/type/components/BitzList/PropsType.d.ts +35 -0
- package/dist/type/components/BitzList/index.d.ts +5 -0
- package/dist/type/components/BitzPagination/index.d.ts +8 -2
- package/dist/type/components/BitzPullRefresh/PropsType.d.ts +43 -0
- package/dist/type/components/BitzPullRefresh/PullRefresh.d.ts +4 -0
- package/dist/type/components/BitzPullRefresh/index.d.ts +5 -0
- package/dist/type/components/BitzSelect/component/BitzSelectMobile.d.ts +1 -0
- package/dist/type/components/BitzTable/ActionBar/ActionBar.d.ts +37 -0
- package/dist/type/components/BitzTable/ActionBar/Button.d.ts +6 -0
- package/dist/type/components/BitzTable/ActionBar/index.d.ts +6 -33
- package/dist/type/components/BitzTable/ActionBar/style.d.ts +2 -2
- package/dist/type/components/BitzTable/Store/index.d.ts +2 -3
- package/dist/type/components/BitzTable/Table/index.d.ts +2 -2
- package/dist/type/components/BitzTable/TableSkeleton/index.d.ts +1 -1
- package/dist/type/components/BitzTable/ToolBar/ExportIcon/index.d.ts +2 -1
- package/dist/type/components/BitzTable/ToolBar/style.d.ts +1 -2
- package/dist/type/components/BitzTable/index.d.ts +5 -1
- package/dist/type/hooks/use-event-listener.d.ts +11 -0
- package/dist/type/hooks/use-lock-fn.d.ts +2 -0
- package/dist/type/hooks/use-scroll-parent.d.ts +9 -0
- package/dist/type/hooks/use-touch.d.ts +18 -0
- package/dist/type/pages/Login2/useRowSelection.d.ts +6 -4
- package/dist/type/pages/Test/index.d.ts +3 -0
- package/dist/type/utils/get-default-props.d.ts +2 -0
- package/dist/type/utils/scroll.d.ts +6 -0
- package/dist/utils/get-default-props.mjs +12 -0
- package/dist/utils/scroll.mjs +15 -0
- package/package.json +2 -1
|
@@ -1,112 +1,174 @@
|
|
|
1
|
-
import { j as
|
|
2
|
-
import { useContext as
|
|
3
|
-
import { isMobile as
|
|
4
|
-
import { theme as
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
1
|
+
import { j as t } from "../../../node_modules/.store/react@18.2.0/node_modules/react/jsx-runtime.mjs";
|
|
2
|
+
import { useContext as ve, useState as J, useMemo as b, useRef as P, useEffect as Me, useCallback as ke } from "react";
|
|
3
|
+
import { isMobile as M } from "../../../node_modules/.store/react-device-detect@2.2.3/node_modules/react-device-detect/dist/lib.mjs";
|
|
4
|
+
import { theme as ze, Table as E, Skeleton as Le } from "antd";
|
|
5
|
+
import We from "../../../node_modules/.store/classnames@2.5.1/node_modules/classnames/index.mjs";
|
|
6
|
+
import Ae from "../../BitzDrawer/index.mjs";
|
|
7
|
+
import Pe from "../../BitzPagination/index.mjs";
|
|
8
|
+
import Ee from "../../BitzNoData/index.mjs";
|
|
9
|
+
import "../../BitzList/index.less.mjs";
|
|
10
|
+
import He from "../../BitzList/List.mjs";
|
|
11
|
+
import "../../BitzPullRefresh/style/index.less.mjs";
|
|
12
|
+
import De from "../../BitzPullRefresh/PullRefresh.mjs";
|
|
13
|
+
import Se, { TableContext as Fe } from "../Store/index.mjs";
|
|
10
14
|
import Oe from "../TableSkeleton/index.mjs";
|
|
11
|
-
import { columnSort as
|
|
12
|
-
import
|
|
15
|
+
import { columnSort as Q, genColumnKey as Y } from "../Store/utils/index.mjs";
|
|
16
|
+
import H from "../../../node_modules/.store/ahooks@3.7.10/node_modules/ahooks/es/useSize/index.mjs";
|
|
17
|
+
import Ve from "../ActionCol/style.mjs";
|
|
13
18
|
import "./index.less.mjs";
|
|
14
|
-
import
|
|
15
|
-
function
|
|
16
|
-
},
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const { token: xe } = Te.useToken(), d = ze(Pe), [ue, T] = U(!1), be = x(() => !!(t != null && t.length) && (t == null ? void 0 : t.length) >= B, [t, B]), [ge, ye] = U([]), we = (e, n) => {
|
|
20
|
-
var h;
|
|
21
|
-
const l = (h = M == null ? void 0 : M(e, n)) == null ? void 0 : h.filter((c) => c.type !== "divider");
|
|
22
|
-
l != null && l.length && (ye(l), T(!0));
|
|
23
|
-
}, $ = () => {
|
|
24
|
-
T(!1);
|
|
25
|
-
}, je = (e) => {
|
|
19
|
+
import _e from "../../../node_modules/.store/lodash-es@4.17.21/node_modules/lodash-es/at.mjs";
|
|
20
|
+
function $e({ showPagination: B = !0, fillEvenRow: D = !0, evenRowBgColor: Ke = "#f9f9f9", height: m, dataSource: s = [], total: k = 0, columns: g, loading: j = !1, skeletonNum: Z = 2, skeletonRender: S, skeletonRowNum: I = 4, skeletonRowsWidth: ee = ["35%", "100%", "100%", "60%"], mobileLoadEmit: oe, mobileRefreshEmit: F, operationFilter: z, enableControlPage: te, pagination: ne, paginationEmit: le = () => {
|
|
21
|
+
}, mobilePageHeight: Re = 500, mobileCancelText: re = "取消", noDataTitle: se, noDataImg: ae, color: qe, size: O, showTableTool: ie = !0, tableAction: ce, tableToolbar: de, selectionBar: he, scroll: c, resetPage: ue, ...d }) {
|
|
22
|
+
var U;
|
|
23
|
+
const { token: h } = ze.useToken(), { gap: fe } = Ve(), u = ve(Fe), [xe, L] = J(!1), be = b(() => !!(s != null && s.length) && (s == null ? void 0 : s.length) >= k, [s, k]), [ge, pe] = J([]), Ce = (e, o) => {
|
|
26
24
|
var n;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
},
|
|
32
|
-
var
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
25
|
+
const l = (n = z == null ? void 0 : z(e, o)) == null ? void 0 : n.filter((r) => r.type !== "divider");
|
|
26
|
+
l != null && l.length && (pe(l), L(!0));
|
|
27
|
+
}, V = () => {
|
|
28
|
+
L(!1);
|
|
29
|
+
}, ye = (e) => {
|
|
30
|
+
var o;
|
|
31
|
+
L(!1), (o = e.onClick) == null || o.call(e);
|
|
32
|
+
}, p = P(null), C = H(p), N = P(null), W = H(N), _ = P(null), y = H(_), me = () => {
|
|
33
|
+
var l;
|
|
34
|
+
const e = (l = N.current) == null ? void 0 : l.querySelectorAll(".ant-table-body tr:not(.ant-table-measure-row)"), o = [];
|
|
35
|
+
if (e == null || e.forEach((n) => {
|
|
36
|
+
var r;
|
|
37
|
+
o.push(((r = n.querySelector(".operationCol .actionGroup")) == null ? void 0 : r.clientWidth) || 0);
|
|
38
|
+
}), o.length)
|
|
39
|
+
return Math.ceil(Math.max(...o)) + fe * 2;
|
|
40
|
+
}, $ = () => {
|
|
41
|
+
var r;
|
|
42
|
+
const e = (r = N.current) == null ? void 0 : r.querySelector(".ant-table-body"), o = e == null ? void 0 : e.clientWidth, l = ((e == null ? void 0 : e.offsetWidth) || 0) - o, n = l > 0;
|
|
43
|
+
return { tbodyWidth: o, scrollBarWidth: l, hasScrollBar: n };
|
|
44
|
+
}, we = (e) => {
|
|
45
|
+
const o = e.length, l = e.filter((x) => x.width), r = l.map((x) => x.width).reduce((x, Te) => x + Te, 0);
|
|
46
|
+
let a = 0;
|
|
47
|
+
if (p.current) {
|
|
48
|
+
const x = window.getComputedStyle(p.current);
|
|
49
|
+
a = parseInt(x.getPropertyValue("--toolCell-width"));
|
|
38
50
|
}
|
|
39
|
-
let
|
|
40
|
-
|
|
41
|
-
const
|
|
42
|
-
return
|
|
43
|
-
}, { y:
|
|
51
|
+
let i = 0;
|
|
52
|
+
d.rowSelection && (i += a), d.expandable && (i += a);
|
|
53
|
+
const { tbodyWidth: v } = $(), f = parseInt(`${T.x}`) || 0, Ne = Math.max(f, v), X = (parseInt(`${Ne}`) || 0) - r - i;
|
|
54
|
+
return X >= 0 ? X / (o - l.length) : void 0;
|
|
55
|
+
}, { y: A, hasScrollBar: K } = b(() => {
|
|
44
56
|
if (typeof m > "u")
|
|
45
57
|
return {};
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
58
|
+
const { hasScrollBar: e } = $();
|
|
59
|
+
let o = 40, l = 40, n = 10;
|
|
60
|
+
if (p.current) {
|
|
61
|
+
const f = window.getComputedStyle(p.current);
|
|
62
|
+
o = parseInt(f.getPropertyValue("--cell-block")), l = parseInt(f.getPropertyValue("--toolbar-height")), n = parseInt(f.getPropertyValue("--container-gap")) || 0;
|
|
50
63
|
}
|
|
51
|
-
const
|
|
52
|
-
return { y: m -
|
|
53
|
-
}, [
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
const r = (y == null ? void 0 : y.height) || 0, a = r ? n : 0;
|
|
65
|
+
return { y: m - r - a - l - o, hasScrollBar: e };
|
|
66
|
+
}, [
|
|
67
|
+
m,
|
|
68
|
+
y == null ? void 0 : y.height,
|
|
69
|
+
C == null ? void 0 : C.height,
|
|
70
|
+
W == null ? void 0 : W.height
|
|
71
|
+
]), T = b(() => c != null && c.x ? { x: c.x, y: c.y || A } : c != null && c.y ? { x: 1e3, y: c.y } : { x: 1e3, y: A }, [c, A]), w = b(() => {
|
|
72
|
+
const e = (a) => a.map((i) => {
|
|
73
|
+
const v = Y((i == null ? void 0 : i.key) || (i == null ? void 0 : i.dataIndex), i.index), f = u.columnsMap[v];
|
|
74
|
+
return f && f.show === !1 ? !1 : i.children ? {
|
|
75
|
+
...i,
|
|
76
|
+
children: e(i.children)
|
|
77
|
+
} : i;
|
|
78
|
+
}).filter(Boolean), o = e(g);
|
|
79
|
+
if (M)
|
|
80
|
+
return o.sort(Q(u.columnsMap));
|
|
81
|
+
const l = o.sort(Q(u.columnsMap)), n = we(l), r = l.map((a) => ({
|
|
82
|
+
...a,
|
|
83
|
+
...a.width ? {
|
|
84
|
+
width: a.useMaxWidth ? me() ?? a.width : a.width
|
|
85
|
+
} : {
|
|
66
86
|
// 给未设置width的列设置平均数
|
|
67
|
-
width:
|
|
87
|
+
width: n
|
|
68
88
|
}
|
|
69
89
|
}));
|
|
70
|
-
return [
|
|
90
|
+
return [E.SELECTION_COLUMN, E.EXPAND_COLUMN, ...r];
|
|
71
91
|
}, [
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
92
|
+
u.columnsMap,
|
|
93
|
+
g,
|
|
94
|
+
M,
|
|
95
|
+
T.x,
|
|
96
|
+
d.rowSelection,
|
|
97
|
+
d.expandable,
|
|
98
|
+
C == null ? void 0 : C.height
|
|
79
99
|
]);
|
|
80
|
-
|
|
81
|
-
if (
|
|
82
|
-
const e =
|
|
100
|
+
Me(() => {
|
|
101
|
+
if (g && g.length > 0) {
|
|
102
|
+
const e = g.map((o) => (
|
|
83
103
|
// @ts-ignore
|
|
84
|
-
|
|
104
|
+
Y((o == null ? void 0 : o.key) ?? (o == null ? void 0 : o.dataIndex), o == null ? void 0 : o.dataIndex)
|
|
85
105
|
));
|
|
86
|
-
|
|
106
|
+
u.setSortKeyColumns(e);
|
|
87
107
|
}
|
|
88
|
-
}, [
|
|
89
|
-
const
|
|
90
|
-
"
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
108
|
+
}, [g]);
|
|
109
|
+
const R = b(() => `${O ?? (u == null ? void 0 : u.tableSize) ?? "lg"}BitzTable`, [O, u.tableSize]), Be = b(() => We(
|
|
110
|
+
"bitzTableContainer",
|
|
111
|
+
/* "hideBorder", */
|
|
112
|
+
{ hasScrollBar: K },
|
|
113
|
+
R
|
|
114
|
+
), [R, K]), je = b(() => {
|
|
115
|
+
var e, o, l, n, r;
|
|
116
|
+
return {
|
|
117
|
+
height: m,
|
|
118
|
+
"--toolbar-bgColor": (e = h.Table) == null ? void 0 : e.toolbarBgColor,
|
|
119
|
+
"--thead-bgColor": (o = h.Table) == null ? void 0 : o.theadBgColor,
|
|
120
|
+
"--thead-hoverBgColor": (l = h.Table) == null ? void 0 : l.theadHoverBgColor,
|
|
121
|
+
"--evenRow-BgColor": (n = h.Table) == null ? void 0 : n.evenRowBgColor,
|
|
122
|
+
"--expandIcon-borderColor": (r = h.Table) == null ? void 0 : r.expandIconBorderColor
|
|
123
|
+
// '--tableBody-bootomBorderColor': token.Table?.borderColor || '#f0f0f0',
|
|
124
|
+
};
|
|
125
|
+
}, [m]), q = ke((e, o) => D ? o % 2 === 0 ? "oddRow" : "evenRow" : "", [D]), G = t.jsx(He, {
|
|
126
|
+
finished: be,
|
|
127
|
+
// @ts-ignore
|
|
128
|
+
onLoad: oe,
|
|
129
|
+
loadingText: "加载中...",
|
|
130
|
+
finishedText: "没有更多了",
|
|
131
|
+
errorText: "加载失败",
|
|
132
|
+
children: t.jsxs("div", { className: "mobileList", style: { backgroundColor: (U = h.Table) == null ? void 0 : U.mobileListBgColor }, children: [s == null ? void 0 : s.map((e, o) => {
|
|
133
|
+
var l;
|
|
134
|
+
return t.jsx("div", { className: "listItem", style: { backgroundColor: (l = h.Table) == null ? void 0 : l.listItemBgColor }, onClick: () => Ce(e, o), children: w == null ? void 0 : w.map((n, r) => {
|
|
135
|
+
var a;
|
|
136
|
+
return !(n != null && n.mobileHide) && t.jsxs("div", { className: "row", style: { color: h.colorText }, children: [!n.mobileHideLabel && t.jsxs("div", { className: "label", children: [`${n.title}`, ":"] }), t.jsx("div", { className: "value", children: ((a = n == null ? void 0 : n.render) == null ? void 0 : a.call(n, _e(e, (n == null ? void 0 : n.dataIndex) || ""), e, o)) || (e == null ? void 0 : e[n.dataIndex]) })] }, r);
|
|
137
|
+
}) }, o);
|
|
138
|
+
}), j && Array.from({ length: Z }).map((e, o) => {
|
|
139
|
+
var l;
|
|
140
|
+
return t.jsx("div", { className: "listItem", style: { backgroundColor: (l = h.Table) == null ? void 0 : l.listItemBgColor }, children: t.jsx("div", { className: "row", children: S ? S() : t.jsx(Le, { title: !1, paragraph: {
|
|
141
|
+
rows: I,
|
|
142
|
+
width: ee
|
|
143
|
+
}, active: !0 }) }) }, o);
|
|
144
|
+
})] })
|
|
145
|
+
});
|
|
146
|
+
return t.jsxs("div", { className: "bitzTableBlock", children: [!M && t.jsxs("div", { ref: p, className: Be, style: je, children: [t.jsxs("div", { className: "bitzTableContainerBody", ref: N, children: [ie && t.jsxs("div", { className: "bitzTableToolbarBlock", children: [ce || t.jsx("div", {}), de, (d == null ? void 0 : d.rowSelection) && t.jsx(t.Fragment, { children: he })] }), t.jsx(E, {
|
|
147
|
+
columns: w,
|
|
148
|
+
dataSource: s,
|
|
149
|
+
loading: !1,
|
|
150
|
+
pagination: !1,
|
|
151
|
+
scroll: T,
|
|
152
|
+
...d,
|
|
153
|
+
// style={style}
|
|
154
|
+
rowClassName: q
|
|
155
|
+
}), t.jsx(Oe, {
|
|
156
|
+
columns: w,
|
|
157
|
+
dataLength: s.length,
|
|
158
|
+
scroll: T,
|
|
159
|
+
rowSelection: d.rowSelection,
|
|
160
|
+
expandable: d.expandable,
|
|
161
|
+
// style={style}
|
|
162
|
+
rowClassName: q,
|
|
163
|
+
loading: j
|
|
164
|
+
})] }), B && t.jsx(Pe, { elRefInstance: _, enableControl: te, pagination: ne, total: k, dataSource: s, resetPage: ue, paginationEmit: le })] }), M && t.jsxs(t.Fragment, { children: [(j || (s == null ? void 0 : s.length) > 0) && t.jsx(t.Fragment, { children: F ? t.jsx(De, { onRefresh: F, children: G }) : G }), !j && t.jsx(Ee, { data: s, title: se, img: ae }), t.jsx(Ae, { className: "tableMobileDrawer", open: xe, placement: "bottom", height: "auto", closable: !1, onClose: V, children: t.jsxs("div", { className: "drawerBox", children: [t.jsx("div", { className: "boxBody", children: ge.map((e, o) => t.jsx("div", { className: "operaList", onClick: () => ye(e), ...e.danger && {
|
|
165
|
+
style: { color: h.colorError }
|
|
166
|
+
}, children: e.label }, o)) }), t.jsx("div", { className: "boxLine" }), t.jsx("div", { className: "boxFooter", onClick: V, children: re })] }) })] })] });
|
|
105
167
|
}
|
|
106
|
-
const
|
|
168
|
+
const uo = (B) => (
|
|
107
169
|
// @ts-ignore
|
|
108
|
-
|
|
170
|
+
t.jsx(Se, { initValue: B, children: t.jsx($e, { ...B }) })
|
|
109
171
|
);
|
|
110
172
|
export {
|
|
111
|
-
|
|
173
|
+
uo as default
|
|
112
174
|
};
|
|
@@ -1,30 +1,32 @@
|
|
|
1
|
-
import { j as
|
|
2
|
-
import { theme as L, Skeleton as
|
|
3
|
-
import
|
|
4
|
-
import { useContext as
|
|
1
|
+
import { j as i } from "../../../node_modules/.store/react@18.2.0/node_modules/react/jsx-runtime.mjs";
|
|
2
|
+
import { theme as L, Skeleton as O, Table as l } from "antd";
|
|
3
|
+
import R from "../../../node_modules/.store/antd@5.15.0/node_modules/antd/es/table/ExpandIcon.mjs";
|
|
4
|
+
import { useContext as S, useMemo as f, useRef as T, useEffect as g } from "react";
|
|
5
5
|
import "../../../node_modules/.store/antd@5.15.0/node_modules/antd/es/config-provider/index.mjs";
|
|
6
|
-
import
|
|
7
|
-
import { ConfigContext as
|
|
8
|
-
const
|
|
9
|
-
var
|
|
10
|
-
const { token: x } = L.useToken(), { table:
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
6
|
+
import h from "../../../node_modules/.store/antd@5.15.0/node_modules/antd/locale/en_US.mjs";
|
|
7
|
+
import { ConfigContext as w } from "../../../node_modules/.store/antd@5.15.0/node_modules/antd/es/config-provider/context.mjs";
|
|
8
|
+
const U = ({ columns: s, dataLength: c, rowSelection: a, expandable: r, loading: o, ...u }) => {
|
|
9
|
+
var m;
|
|
10
|
+
const { token: x } = L.useToken(), { table: p, locale: y = h } = S(w), C = { ...y.Table }, b = ((m = p == null ? void 0 : p.expandable) == null ? void 0 : m.expandIcon) || (r == null ? void 0 : r.expandIcon) || R(C), k = f(() => {
|
|
11
|
+
if (!o)
|
|
12
|
+
return [];
|
|
13
|
+
const t = c > 4 ? c >= 20 ? 20 : c : 4;
|
|
14
|
+
return Array.from({ length: t }).map((e, n) => ({ index: n }));
|
|
15
|
+
}, [o, c]), I = f(() => {
|
|
14
16
|
var t;
|
|
15
|
-
return (t =
|
|
17
|
+
return (t = s == null ? void 0 : s.filter((e) => Object.keys(e).length !== 0)) == null ? void 0 : t.map((e) => e != null && e.isOperationCol ? e : {
|
|
16
18
|
...e,
|
|
17
19
|
sorter: !1,
|
|
18
|
-
render: (
|
|
20
|
+
render: (n, N, _) => i.jsx(O, { active: !0, title: !1, paragraph: {
|
|
19
21
|
rows: 1,
|
|
20
|
-
width: (
|
|
22
|
+
width: (_ + 1) % 2 === 0 ? "100%" : "60%"
|
|
21
23
|
} })
|
|
22
24
|
});
|
|
23
|
-
}, [
|
|
24
|
-
if (
|
|
25
|
+
}, [s]), E = f(() => {
|
|
26
|
+
if (r)
|
|
25
27
|
return {
|
|
26
|
-
...
|
|
27
|
-
expandedRowRender: () =>
|
|
28
|
+
...r,
|
|
29
|
+
expandedRowRender: () => i.jsx(i.Fragment, {}),
|
|
28
30
|
expandIcon: (t) => {
|
|
29
31
|
const e = b(t);
|
|
30
32
|
return {
|
|
@@ -40,27 +42,29 @@ const q = ({ columns: n, pageSize: a, rowSelection: i, expandable: o, loading: l
|
|
|
40
42
|
};
|
|
41
43
|
}
|
|
42
44
|
};
|
|
43
|
-
}, [
|
|
44
|
-
if (
|
|
45
|
+
}, [r]), j = f(() => {
|
|
46
|
+
if (a)
|
|
45
47
|
return {
|
|
46
|
-
...
|
|
48
|
+
...a,
|
|
47
49
|
selectedRowKeys: [],
|
|
48
50
|
getCheckboxProps: () => ({ disabled: !0 })
|
|
49
51
|
};
|
|
50
|
-
}, [
|
|
51
|
-
return
|
|
52
|
-
var e,
|
|
53
|
-
const t = (
|
|
54
|
-
t && (t.
|
|
55
|
-
}, [
|
|
52
|
+
}, [a]), d = T();
|
|
53
|
+
return g(() => {
|
|
54
|
+
var e, n;
|
|
55
|
+
const t = (n = (e = d.current) == null ? void 0 : e.nativeElement) == null ? void 0 : n.querySelector(".ant-table-body");
|
|
56
|
+
t && (t.scrollLeft = 0);
|
|
57
|
+
}, [o]), i.jsx(l, { ...u, ref: d, expandable: E, rowSelection: j, pagination: !1, columns: [l.SELECTION_COLUMN, l.EXPAND_COLUMN, ...I], rowKey: "index", dataSource: k, loading: !1, style: {
|
|
58
|
+
...u.style,
|
|
56
59
|
position: "absolute",
|
|
57
60
|
inset: 0,
|
|
58
61
|
top: 40,
|
|
59
|
-
zIndex:
|
|
62
|
+
zIndex: o ? 100 : -1,
|
|
60
63
|
/** 保险起见,使用了zIndex也要用opacity控制显隐 */
|
|
61
|
-
opacity:
|
|
62
|
-
|
|
64
|
+
opacity: o ? 1 : 0,
|
|
65
|
+
background: o ? "#fff" : "transparent"
|
|
66
|
+
} });
|
|
63
67
|
};
|
|
64
68
|
export {
|
|
65
|
-
|
|
69
|
+
U as default
|
|
66
70
|
};
|
|
@@ -1,126 +1,115 @@
|
|
|
1
|
-
import { j as
|
|
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
|
|
1
|
+
import { j as s } from "../../../../node_modules/.store/react@18.2.0/node_modules/react/jsx-runtime.mjs";
|
|
2
|
+
import { create as Q, useModal as U, antdModalV5 as X } from "@ebay/nice-modal-react";
|
|
3
|
+
import { Modal as Y, Checkbox as Z, Button as $ } from "antd";
|
|
4
|
+
import a from "./index.module.less.mjs";
|
|
5
|
+
import { useState as A, useContext as L, useEffect as ee, useCallback as I, useMemo as k } from "react";
|
|
6
|
+
import { TableContext as se } from "../../Store/index.mjs";
|
|
7
|
+
import { genColumnKey as _, columnSort as oe } from "../../Store/utils/index.mjs";
|
|
8
|
+
import d from "../../../../node_modules/.store/classnames@2.5.1/node_modules/classnames/index.mjs";
|
|
9
|
+
import { DndContext as te } from "../../../../node_modules/.store/@dnd-kit_core@6.1.0/node_modules/@dnd-kit/core/dist/core.esm.mjs";
|
|
10
|
+
import { SortableContext as le, verticalListSortingStrategy as ne, arrayMove as ae } from "../../../../node_modules/.store/@dnd-kit_sortable@7.0.2/node_modules/@dnd-kit/sortable/dist/sortable.esm.mjs";
|
|
11
|
+
import ce from "./DndItem.mjs";
|
|
12
|
+
import { restrictToVerticalAxis as ie, restrictToWindowEdges as ue } from "../../../../node_modules/.store/@dnd-kit_modifiers@6.0.1/node_modules/@dnd-kit/modifiers/dist/modifiers.esm.mjs";
|
|
13
|
+
import F from "../../../BitzButton/index.mjs";
|
|
14
14
|
import "./index.less.mjs";
|
|
15
|
-
import { useImmer as
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
styles: {
|
|
23
|
-
active: {
|
|
24
|
-
opacity: "0.5"
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
})
|
|
28
|
-
}, Os = X(() => {
|
|
29
|
-
var S;
|
|
30
|
-
const x = Y(), [d, j] = w(null), [z, v] = w(!1), [c, h] = ds({
|
|
15
|
+
import { useImmer as me } from "../../../../node_modules/.store/use-immer@0.9.0/node_modules/use-immer/dist/use-immer.module.mjs";
|
|
16
|
+
import H from "../../../../node_modules/.store/lodash-es@4.17.21/node_modules/lodash-es/omit.mjs";
|
|
17
|
+
import re from "../../../../node_modules/.store/@ant-design_icons@5.3.1/node_modules/@ant-design/icons/es/icons/CheckCircleOutlined.mjs";
|
|
18
|
+
import de from "../../../../node_modules/.store/@ant-design_icons@5.3.1/node_modules/@ant-design/icons/es/icons/RedoOutlined.mjs";
|
|
19
|
+
const Be = Q(() => {
|
|
20
|
+
var D;
|
|
21
|
+
const h = U(), [C, b] = A(null), [T, S] = A(!1), [c, x] = me({
|
|
31
22
|
columnsMap: {},
|
|
32
23
|
sortKeyColumns: []
|
|
33
24
|
}), {
|
|
34
25
|
persistenceType: R,
|
|
35
|
-
persistenceKey:
|
|
36
|
-
onlineChange:
|
|
37
|
-
columnsMap:
|
|
38
|
-
setColumnsMap:
|
|
39
|
-
sortKeyColumns:
|
|
40
|
-
setSortKeyColumns:
|
|
26
|
+
persistenceKey: v,
|
|
27
|
+
onlineChange: f,
|
|
28
|
+
columnsMap: z,
|
|
29
|
+
setColumnsMap: O,
|
|
30
|
+
sortKeyColumns: V,
|
|
31
|
+
setSortKeyColumns: W,
|
|
41
32
|
// clearPersistenceStorage,
|
|
42
33
|
...l
|
|
43
|
-
} = L(
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
34
|
+
} = L(se);
|
|
35
|
+
ee(() => {
|
|
36
|
+
x((e) => {
|
|
37
|
+
e.columnsMap = { ...z }, e.sortKeyColumns = [...V];
|
|
47
38
|
});
|
|
48
39
|
}, []);
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
|
|
40
|
+
const q = I(() => {
|
|
41
|
+
x((e) => {
|
|
42
|
+
e.columnsMap = { ...l.defaultColumnKeyMap };
|
|
52
43
|
});
|
|
53
|
-
}, []), p =
|
|
44
|
+
}, []), p = k(() => {
|
|
54
45
|
var o, n;
|
|
55
|
-
const
|
|
56
|
-
return (o = l == null ? void 0 : l.columns) != null && o.length && ((n = l == null ? void 0 : l.columns) == null || n.map(({ key:
|
|
57
|
-
const
|
|
58
|
-
return (m == null ? void 0 : m.show) !== !1 &&
|
|
59
|
-
key:
|
|
60
|
-
...
|
|
46
|
+
const e = [];
|
|
47
|
+
return (o = l == null ? void 0 : l.columns) != null && o.length && ((n = l == null ? void 0 : l.columns) == null || n.map(({ key: r, dataIndex: t, ...u }) => {
|
|
48
|
+
const y = _(r || t, [r || t].filter(Boolean).join("-")), m = c.columnsMap[y || "null"];
|
|
49
|
+
return (m == null ? void 0 : m.show) !== !1 && e.push({
|
|
50
|
+
key: y,
|
|
51
|
+
...H(u, ["className"]),
|
|
61
52
|
selectable: !1,
|
|
62
53
|
disabled: (m == null ? void 0 : m.disable) === !0
|
|
63
54
|
}), m;
|
|
64
|
-
})),
|
|
65
|
-
}, [c.columnsMap, l == null ? void 0 : l.columns]),
|
|
55
|
+
})), e.sort(oe(c.columnsMap));
|
|
56
|
+
}, [c.columnsMap, l == null ? void 0 : l.columns]), j = I((e) => {
|
|
66
57
|
var o;
|
|
67
|
-
return (o = c.sortKeyColumns) == null ? void 0 : o.findIndex((n) => n ===
|
|
68
|
-
}, [c.sortKeyColumns]),
|
|
69
|
-
const
|
|
70
|
-
return { list: ((
|
|
71
|
-
var
|
|
72
|
-
const
|
|
73
|
-
(i == null ? void 0 : i.show) !== !1 && !m &&
|
|
74
|
-
const
|
|
75
|
-
key:
|
|
76
|
-
...
|
|
58
|
+
return (o = c.sortKeyColumns) == null ? void 0 : o.findIndex((n) => n === e);
|
|
59
|
+
}, [c.sortKeyColumns]), E = k(() => C ? j(C) : -1, [C, j]), N = k(() => {
|
|
60
|
+
const e = [], o = /* @__PURE__ */ new Map();
|
|
61
|
+
return { list: ((r, t) => r.map(({ key: u, dataIndex: y, children: m, ...K }) => {
|
|
62
|
+
var B;
|
|
63
|
+
const M = _(u || y, [t == null ? void 0 : t.columnKey, K.index].filter(Boolean).join("-")), i = c.columnsMap[M || "null"] || { show: !0 };
|
|
64
|
+
(i == null ? void 0 : i.show) !== !1 && !m && e.push(M);
|
|
65
|
+
const w = {
|
|
66
|
+
key: M,
|
|
67
|
+
...H(K, ["className"]),
|
|
77
68
|
selectable: !1,
|
|
78
69
|
disabled: i.disable === !0,
|
|
79
|
-
disableCheckbox: typeof i.disable == "boolean" ? i == null ? void 0 : i.disable : (
|
|
80
|
-
isLeaf:
|
|
70
|
+
disableCheckbox: typeof i.disable == "boolean" ? i == null ? void 0 : i.disable : (B = i == null ? void 0 : i.disable) == null ? void 0 : B.checkbox,
|
|
71
|
+
isLeaf: t ? !0 : void 0
|
|
81
72
|
};
|
|
82
|
-
return o.set(
|
|
83
|
-
}))(l == null ? void 0 : l.columns), keys:
|
|
84
|
-
}, [c.columnsMap, l == null ? void 0 : l.columns]),
|
|
73
|
+
return o.set(u, w), w;
|
|
74
|
+
}))(l == null ? void 0 : l.columns), keys: e, map: o };
|
|
75
|
+
}, [c.columnsMap, l == null ? void 0 : l.columns]), G = (e, o) => {
|
|
85
76
|
const n = { ...c.columnsMap };
|
|
86
|
-
((
|
|
87
|
-
const
|
|
88
|
-
|
|
89
|
-
})(o.key),
|
|
90
|
-
|
|
77
|
+
((t) => {
|
|
78
|
+
const u = { ...n[t] };
|
|
79
|
+
u.show = !e, n[t] = u;
|
|
80
|
+
})(o.key), S(!0), x((t) => {
|
|
81
|
+
t.columnsMap = { ...n };
|
|
91
82
|
});
|
|
92
|
-
},
|
|
93
|
-
const n = { ...c.columnsMap },
|
|
94
|
-
|
|
95
|
-
n[
|
|
96
|
-
}),
|
|
97
|
-
|
|
83
|
+
}, J = (e, o) => {
|
|
84
|
+
const n = { ...c.columnsMap }, r = ae(c.sortKeyColumns, e, o);
|
|
85
|
+
r.forEach((t, u) => {
|
|
86
|
+
n[t] = { ...n[t] || {}, order: u };
|
|
87
|
+
}), S(!0), x((t) => {
|
|
88
|
+
t.columnsMap = { ...n }, t.sortKeyColumns = r;
|
|
98
89
|
});
|
|
99
|
-
},
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
W(c.columnsMap), G(c.sortKeyColumns), R === "online" && k && (C == null || C(k, c.columnsMap)), x.resolve({ ...c.columnsMap }), x.hide();
|
|
104
|
-
}, D = () => {
|
|
105
|
-
x.hide();
|
|
90
|
+
}, P = () => {
|
|
91
|
+
O(c.columnsMap), W(c.sortKeyColumns), R === "online" && v && (f == null || f(v, c.columnsMap)), h.resolve({ ...c.columnsMap }), h.hide();
|
|
92
|
+
}, g = () => {
|
|
93
|
+
h.hide();
|
|
106
94
|
};
|
|
107
|
-
return
|
|
108
|
-
const o =
|
|
109
|
-
return
|
|
110
|
-
[
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
95
|
+
return s.jsxs(Y, { className: "tableColumnSettingModal", title: "自定义列", ...X(h), styles: { body: { maxHeight: window.innerHeight - 300 } }, width: 600, onCancel: g, footer: s.jsxs(s.Fragment, { children: [s.jsx(F, { type: "primary", icon: s.jsx(re, {}), onClick: P, disabled: !T, children: "保存" }), s.jsx(F, { onClick: g, children: "取消" })] }), children: [s.jsx("div", { className: d(a.introduce, "tableColumnSetting_introduce"), children: "选择要在表中显示的可用列。拖动选定的列以对其重新排序。" }), s.jsxs("div", { className: d(a.container, "tableColumnSetting_container"), style: { maxHeight: window.innerHeight - 390, overflow: "auto" }, children: [s.jsxs("div", { className: a.block, children: [s.jsxs("div", { className: d(a.header, "tableColumnSetting_header"), children: [s.jsx("div", { className: d(a.title, "tableColumnSetting_title"), children: "可用列" }), s.jsx("div", {})] }), s.jsx("div", { className: d(a.body, "tableColumnSetting_body"), children: s.jsx("ul", { className: a.content, children: (D = N.list) == null ? void 0 : D.map((e) => {
|
|
96
|
+
const o = N.keys.includes(e.key);
|
|
97
|
+
return s.jsxs("li", { className: d(a.item, {
|
|
98
|
+
[a.checked]: !o,
|
|
99
|
+
tableColumnSetting_checked: !o
|
|
100
|
+
}), onClick: () => !e.disabled && G(o, e), children: [s.jsx(Z, { checked: o, disabled: e.disabled }), s.jsx("span", { className: d(a["content-item-text"], "tableColumnSetting_content-item-text"), children: e.title })] }, e.key);
|
|
101
|
+
}) }) })] }), s.jsxs("div", { className: a.block, children: [s.jsxs("div", { className: a.header, children: [s.jsx("div", { className: a.title, children: "选定列" }), s.jsx($, { type: "link", icon: s.jsx(de, {}), size: "small", onClick: q, children: "重置" })] }), s.jsx("div", { className: d(a.body, "tableColumnSetting_body-order"), children: s.jsx(te, { modifiers: [ie, ue], onDragStart: (e) => {
|
|
102
|
+
const { active: o } = e;
|
|
103
|
+
o && b(o == null ? void 0 : o.id);
|
|
104
|
+
}, onDragCancel: () => b(null), onDragEnd: (e) => {
|
|
105
|
+
b(null);
|
|
106
|
+
const { over: o } = e;
|
|
118
107
|
if (o) {
|
|
119
|
-
const n =
|
|
120
|
-
|
|
108
|
+
const n = j(o.id);
|
|
109
|
+
E !== n && J(E, n);
|
|
121
110
|
}
|
|
122
|
-
}, children:
|
|
111
|
+
}, children: s.jsx(le, { items: p == null ? void 0 : p.map((e) => e.key), strategy: ne, children: s.jsx("ul", { className: a.content, children: p == null ? void 0 : p.map((e) => s.jsx(ce, { item: e }, e.key)) }) }) }) })] })] })] });
|
|
123
112
|
});
|
|
124
113
|
export {
|
|
125
|
-
|
|
114
|
+
Be as default
|
|
126
115
|
};
|