@hkyhy/marsun-components-core 0.1.81 → 0.1.82
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/components/Table/ResizableHeaderCell.js +46 -42
- package/dist/components/Table/ResizableHeaderCell.js.map +1 -1
- package/dist/components/Table/Table.d.ts +2 -2
- package/dist/components/Table/Table.js +197 -190
- package/dist/components/Table/Table.js.map +1 -1
- package/dist/components/Table/columnConfigUtils.d.ts +11 -0
- package/dist/components/Table/columnConfigUtils.js +90 -79
- package/dist/components/Table/columnConfigUtils.js.map +1 -1
- package/dist/components/Table/index.d.ts +1 -1
- package/dist/index.js +357 -355
- package/package.json +1 -1
|
@@ -1,95 +1,97 @@
|
|
|
1
1
|
import { jsx as y, jsxs as et } from "react/jsx-runtime";
|
|
2
|
-
import { Space as ve, Button as
|
|
2
|
+
import { Space as ve, Button as jt, Tooltip as Ut, Table as _e } from "antd";
|
|
3
3
|
import at from "classnames";
|
|
4
4
|
import { forwardRef as Pe, useImperativeHandle as Ie, useMemo as x, useRef as yt, useState as tt, useEffect as gt, useCallback as z } from "react";
|
|
5
5
|
import { flushSync as Ee } from "react-dom";
|
|
6
|
-
import
|
|
6
|
+
import kt from "./columnConfig.module.scss.js";
|
|
7
7
|
import { ColumnConfigTrigger as Te } from "./ColumnConfigPanel.js";
|
|
8
|
-
import { COLUMN_RESIZE_MAX_WIDTH as Ae, COLUMN_RESIZE_MIN_WIDTH as Ne, columnsLeafPathSignature as
|
|
9
|
-
import
|
|
8
|
+
import { COLUMN_RESIZE_MAX_WIDTH as Ae, COLUMN_RESIZE_MIN_WIDTH as Ne, columnsLeafPathSignature as Fe, applyColumnConfig as je, applyLeafWidthOverrides as Mt, columnsToPanelItems as ke, copyColumnWidths as Me, columnsToConfig as Bt, clampColumnWidth as St, setColumnWidthAtPath as Be, clearColumnWidthAtPath as De, hideColumnAtPath as Ue, configHasLeafWidths as $e, insertBeforeFixedRight as Ge, FLEX_SPACER_COL_KEY as qe, COLUMN_CONFIG_COL_KEY as Xe, isInternalColumnKey as Wt, isFixedColumn as Ze, shortChildId as $t } from "./columnConfigUtils.js";
|
|
9
|
+
import Ye from "./ResizableHeaderCell.js";
|
|
10
10
|
import p from "./style.module.scss.js";
|
|
11
|
-
import { emptyTablePrefs as
|
|
12
|
-
import { normalizeHiddenRowKeys as
|
|
13
|
-
import { parseTablePrefs as
|
|
14
|
-
import { useTableFetch as
|
|
15
|
-
import { useMarsunFetch as
|
|
16
|
-
import
|
|
11
|
+
import { emptyTablePrefs as Je } from "./tablePrefsTypes.js";
|
|
12
|
+
import { normalizeHiddenRowKeys as Ct, mergeTablePrefs as lt, applyHiddenRows as Qe } from "./tablePrefsUtils.js";
|
|
13
|
+
import { parseTablePrefs as Rn, serializeTablePrefs as bn } from "./tablePrefsUtils.js";
|
|
14
|
+
import { useTableFetch as Ve } from "./useTableFetch.js";
|
|
15
|
+
import { useMarsunFetch as we } from "../../provider/context.js";
|
|
16
|
+
import Dt from "../Empty/Empty.js";
|
|
17
17
|
import { Eye as Gt } from "../Icons/Eye.js";
|
|
18
|
-
const
|
|
19
|
-
function
|
|
20
|
-
return `共 ${
|
|
18
|
+
const Ke = { x: "max-content" }, G = 40, tn = 64;
|
|
19
|
+
function en(l) {
|
|
20
|
+
return `共 ${l} 项`;
|
|
21
21
|
}
|
|
22
|
-
function qt(
|
|
22
|
+
function qt(l) {
|
|
23
23
|
var f;
|
|
24
|
-
if (!(
|
|
25
|
-
let
|
|
26
|
-
for (const o of
|
|
27
|
-
const
|
|
28
|
-
if (
|
|
24
|
+
if (!(l != null && l.length)) return 0;
|
|
25
|
+
let a = 0;
|
|
26
|
+
for (const o of l) {
|
|
27
|
+
const s = o.key != null ? String(o.key) : "";
|
|
28
|
+
if (s && Wt(s)) continue;
|
|
29
29
|
if ((f = o.children) != null && f.length) {
|
|
30
|
-
|
|
30
|
+
a += qt(o.children);
|
|
31
31
|
continue;
|
|
32
32
|
}
|
|
33
33
|
const c = o.width;
|
|
34
|
-
typeof c == "number" && Number.isFinite(c) && c > 0 ?
|
|
34
|
+
typeof c == "number" && Number.isFinite(c) && c > 0 ? a += c : a += tn;
|
|
35
35
|
}
|
|
36
|
-
return
|
|
36
|
+
return a;
|
|
37
37
|
}
|
|
38
|
-
function Xt(
|
|
39
|
-
return
|
|
38
|
+
function Xt(l, a) {
|
|
39
|
+
return l.key != null && String(l.key) !== "" ? String(l.key) : l.dataIndex != null ? Array.isArray(l.dataIndex) ? l.dataIndex.join(".") : String(l.dataIndex) : `__col_${a}`;
|
|
40
40
|
}
|
|
41
|
-
function
|
|
42
|
-
if (typeof f == "function") return String(f(
|
|
41
|
+
function nn(l, a, f) {
|
|
42
|
+
if (typeof f == "function") return String(f(l, a));
|
|
43
43
|
if (typeof f == "string" && f) {
|
|
44
|
-
const o =
|
|
44
|
+
const o = l[f];
|
|
45
45
|
if (o != null && o !== "") return String(o);
|
|
46
46
|
}
|
|
47
|
-
return String(
|
|
47
|
+
return String(a);
|
|
48
48
|
}
|
|
49
|
-
function Zt(
|
|
50
|
-
return
|
|
51
|
-
var
|
|
52
|
-
const _ = Xt(
|
|
53
|
-
if (
|
|
54
|
-
const d = f ? $t(f, _) : _, O = [...o, d], u =
|
|
55
|
-
if ((
|
|
49
|
+
function Zt(l, a, f, o = []) {
|
|
50
|
+
return l.map((s, c) => {
|
|
51
|
+
var R;
|
|
52
|
+
const _ = Xt(s, c);
|
|
53
|
+
if (Wt(_)) return s;
|
|
54
|
+
const d = f ? $t(f, _) : _, O = [...o, d], u = s.onHeaderCell;
|
|
55
|
+
if ((R = s.children) != null && R.length)
|
|
56
56
|
return {
|
|
57
|
-
...
|
|
57
|
+
...s,
|
|
58
58
|
children: Zt(
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
s.children,
|
|
60
|
+
a,
|
|
61
61
|
_,
|
|
62
62
|
O
|
|
63
63
|
)
|
|
64
64
|
};
|
|
65
|
-
|
|
65
|
+
if (Ze(s))
|
|
66
|
+
return s;
|
|
67
|
+
const q = O.join("/"), P = a.widthByPath[q] ?? (typeof s.width == "number" && Number.isFinite(s.width) ? s.width : void 0);
|
|
66
68
|
return {
|
|
67
|
-
...
|
|
68
|
-
onHeaderCell: (
|
|
69
|
-
...typeof u == "function" ? u(
|
|
69
|
+
...s,
|
|
70
|
+
onHeaderCell: (W) => ({
|
|
71
|
+
...typeof u == "function" ? u(W) : u || {},
|
|
70
72
|
"data-marsun-col-path": q,
|
|
71
73
|
width: P,
|
|
72
|
-
minWidth:
|
|
73
|
-
maxWidth:
|
|
74
|
-
onResizeStart: () =>
|
|
75
|
-
onResize: (I) =>
|
|
76
|
-
onResizeStop: (I) =>
|
|
77
|
-
onReset: () =>
|
|
74
|
+
minWidth: a.minWidth,
|
|
75
|
+
maxWidth: a.maxWidth,
|
|
76
|
+
onResizeStart: () => a.onResizeStartPath(O),
|
|
77
|
+
onResize: (I) => a.onResizePath(O, I),
|
|
78
|
+
onResizeStop: (I) => a.onResizeStopPath(O, I),
|
|
79
|
+
onReset: () => a.onResetPath(O)
|
|
78
80
|
})
|
|
79
81
|
};
|
|
80
82
|
});
|
|
81
83
|
}
|
|
82
|
-
const
|
|
83
|
-
function Yt(
|
|
84
|
+
const rn = 6;
|
|
85
|
+
function Yt(l, a, f, o = [], s = 0, c) {
|
|
84
86
|
let _ = 0;
|
|
85
|
-
return
|
|
87
|
+
return l.map((d, O) => {
|
|
86
88
|
var g, N;
|
|
87
89
|
const u = Xt(d, O);
|
|
88
|
-
if (
|
|
89
|
-
const q = f ? $t(f, u) : u, P = [...o, q],
|
|
90
|
-
let
|
|
91
|
-
|
|
92
|
-
const
|
|
90
|
+
if (Wt(u)) return d;
|
|
91
|
+
const q = f ? $t(f, u) : u, P = [...o, q], R = d.onHeaderCell;
|
|
92
|
+
let W = c;
|
|
93
|
+
s === 0 && (W = (g = d.children) != null && g.length ? _++ : void 0);
|
|
94
|
+
const D = W == null ? void 0 : s === 0 ? p.headerDepth0 : s === 1 ? p.headerDepth1 : p.headerDepth2, I = W == null ? void 0 : p[`headerGroup${W % rn}`], U = /* @__PURE__ */ et("span", { className: p.headerTitleWithEye, children: [
|
|
93
95
|
/* @__PURE__ */ y("span", { className: p.headerTitleText, children: d.title }),
|
|
94
96
|
/* @__PURE__ */ y(Ut, { title: "隐藏此列", children: /* @__PURE__ */ y(
|
|
95
97
|
"button",
|
|
@@ -97,44 +99,44 @@ function Yt(i, l, f, o = [], a = 0, c) {
|
|
|
97
99
|
type: "button",
|
|
98
100
|
className: p.headerEyeBtn,
|
|
99
101
|
"aria-label": "隐藏此列",
|
|
100
|
-
onClick: (
|
|
101
|
-
|
|
102
|
+
onClick: (F) => {
|
|
103
|
+
F.stopPropagation(), a(P);
|
|
102
104
|
},
|
|
103
105
|
children: /* @__PURE__ */ y(Gt, { size: 12 })
|
|
104
106
|
}
|
|
105
107
|
) })
|
|
106
|
-
] }),
|
|
107
|
-
const X = typeof
|
|
108
|
+
] }), b = (F) => {
|
|
109
|
+
const X = typeof R == "function" ? R(F) : R || {};
|
|
108
110
|
return {
|
|
109
111
|
...X,
|
|
110
|
-
className: at(X.className, I,
|
|
112
|
+
className: at(X.className, I, D)
|
|
111
113
|
};
|
|
112
114
|
};
|
|
113
115
|
return (N = d.children) != null && N.length ? {
|
|
114
116
|
...d,
|
|
115
117
|
title: U,
|
|
116
|
-
onHeaderCell:
|
|
118
|
+
onHeaderCell: b,
|
|
117
119
|
children: Yt(
|
|
118
120
|
d.children,
|
|
119
|
-
|
|
121
|
+
a,
|
|
120
122
|
u,
|
|
121
123
|
P,
|
|
122
|
-
|
|
123
|
-
|
|
124
|
+
s + 1,
|
|
125
|
+
W
|
|
124
126
|
)
|
|
125
127
|
} : {
|
|
126
128
|
...d,
|
|
127
129
|
title: U,
|
|
128
|
-
onHeaderCell:
|
|
130
|
+
onHeaderCell: b
|
|
129
131
|
};
|
|
130
132
|
});
|
|
131
133
|
}
|
|
132
|
-
function
|
|
133
|
-
className:
|
|
134
|
-
style:
|
|
134
|
+
function sn({
|
|
135
|
+
className: l,
|
|
136
|
+
style: a,
|
|
135
137
|
scroll: f,
|
|
136
138
|
pagination: o,
|
|
137
|
-
locale:
|
|
139
|
+
locale: s,
|
|
138
140
|
columns: c,
|
|
139
141
|
dataSource: _,
|
|
140
142
|
rowKey: d,
|
|
@@ -142,18 +144,18 @@ function nn({
|
|
|
142
144
|
tableName: u,
|
|
143
145
|
columnConfigEnabled: q,
|
|
144
146
|
fetchColumnConfig: P,
|
|
145
|
-
saveColumnConfig:
|
|
146
|
-
onColumnConfigChange:
|
|
147
|
-
fetchTablePrefs:
|
|
147
|
+
saveColumnConfig: R,
|
|
148
|
+
onColumnConfigChange: W,
|
|
149
|
+
fetchTablePrefs: D,
|
|
148
150
|
saveTablePrefs: I,
|
|
149
151
|
onTablePrefsChange: U,
|
|
150
|
-
rowConfigEnabled:
|
|
152
|
+
rowConfigEnabled: b = !1,
|
|
151
153
|
lockedRowKeys: g,
|
|
152
154
|
hiddenRowKeys: N,
|
|
153
|
-
onHiddenRowKeysChange:
|
|
155
|
+
onHiddenRowKeysChange: F,
|
|
154
156
|
rowHideSelectedKeys: X,
|
|
155
157
|
rowConfigToolbar: nt,
|
|
156
|
-
rowSelection:
|
|
158
|
+
rowSelection: L,
|
|
157
159
|
columnResizeEnabled: Jt,
|
|
158
160
|
columnResizeMinWidth: Qt = Ne,
|
|
159
161
|
columnResizeMaxWidth: Vt = Ae,
|
|
@@ -168,8 +170,8 @@ function nn({
|
|
|
168
170
|
components: Z,
|
|
169
171
|
...le
|
|
170
172
|
}, ae) {
|
|
171
|
-
var
|
|
172
|
-
const ot =
|
|
173
|
+
var Ft;
|
|
174
|
+
const ot = we(), {
|
|
173
175
|
fetchMode: ct,
|
|
174
176
|
rows: oe,
|
|
175
177
|
total: ce,
|
|
@@ -179,7 +181,7 @@ function nn({
|
|
|
179
181
|
pageSize: he,
|
|
180
182
|
setPage: fe,
|
|
181
183
|
reload: zt
|
|
182
|
-
} =
|
|
184
|
+
} = Ve({
|
|
183
185
|
dataSource: _,
|
|
184
186
|
fetchData: wt,
|
|
185
187
|
fetchUrl: Kt,
|
|
@@ -194,21 +196,21 @@ function nn({
|
|
|
194
196
|
onFetched: ie
|
|
195
197
|
});
|
|
196
198
|
Ie(ae, () => ({ reload: zt }), [zt]);
|
|
197
|
-
const ut = ct ? oe : _, me = !!O || ct && ue,
|
|
199
|
+
const ut = ct ? oe : _, me = !!O || ct && ue, j = q ?? !!u, v = Jt ?? !!u, E = Qt, T = Vt, Y = x(
|
|
198
200
|
() => ({ minWidth: E, maxWidth: T }),
|
|
199
201
|
[E, T]
|
|
200
|
-
), rt = yt(c), dt = yt(null), [
|
|
201
|
-
$.current =
|
|
202
|
+
), rt = yt(c), dt = yt(null), [i, st] = tt(null), [Ht, pe] = tt(!1), [ht, ft] = tt(!j), [Ot, ye] = tt([]), [k, Q] = tt({}), $ = yt(k);
|
|
203
|
+
$.current = k, gt(() => {
|
|
202
204
|
rt.current = c;
|
|
203
205
|
}, [c]);
|
|
204
206
|
const ge = x(
|
|
205
|
-
() =>
|
|
207
|
+
() => Fe(c || []),
|
|
206
208
|
[c]
|
|
207
209
|
);
|
|
208
210
|
gt(() => {
|
|
209
211
|
Q({}), $.current = {};
|
|
210
212
|
}, [ge]), gt(() => {
|
|
211
|
-
if (!
|
|
213
|
+
if (!j && !v || !u || !(D || P)) {
|
|
212
214
|
ft(!0);
|
|
213
215
|
return;
|
|
214
216
|
}
|
|
@@ -216,12 +218,12 @@ function nn({
|
|
|
216
218
|
return ft(!1), (async () => {
|
|
217
219
|
var n;
|
|
218
220
|
try {
|
|
219
|
-
if (
|
|
220
|
-
const r = await
|
|
221
|
+
if (D) {
|
|
222
|
+
const r = await D(u);
|
|
221
223
|
t || st((n = r == null ? void 0 : r.columns) != null && n.length ? r : null);
|
|
222
224
|
} else if (P) {
|
|
223
225
|
const r = await P(u);
|
|
224
|
-
t || st(r != null && r.length ?
|
|
226
|
+
t || st(r != null && r.length ? Je(r) : null);
|
|
225
227
|
}
|
|
226
228
|
} catch {
|
|
227
229
|
t || st(null);
|
|
@@ -231,57 +233,57 @@ function nn({
|
|
|
231
233
|
})(), () => {
|
|
232
234
|
t = !0;
|
|
233
235
|
};
|
|
234
|
-
}, [
|
|
235
|
-
const A = (
|
|
236
|
+
}, [j, v, u, D, P]);
|
|
237
|
+
const A = (Ft = i == null ? void 0 : i.columns) != null && Ft.length ? i.columns : null, M = x(() => N !== void 0 ? Ct(N, g) : Ct(Ot, g), [N, Ot, g]), J = z(
|
|
236
238
|
(t) => {
|
|
237
|
-
const e =
|
|
238
|
-
N === void 0 && ye(e),
|
|
239
|
+
const e = Ct(t, g);
|
|
240
|
+
N === void 0 && ye(e), F == null || F(e);
|
|
239
241
|
},
|
|
240
|
-
[N, g,
|
|
241
|
-
),
|
|
242
|
+
[N, g, F]
|
|
243
|
+
), B = z(
|
|
242
244
|
async (t) => {
|
|
243
|
-
if (st(t), U == null || U(t),
|
|
245
|
+
if (st(t), U == null || U(t), W == null || W(t.columns), u && I) {
|
|
244
246
|
await I(u, t);
|
|
245
247
|
return;
|
|
246
248
|
}
|
|
247
|
-
u &&
|
|
249
|
+
u && R && await R(u, t.columns);
|
|
248
250
|
},
|
|
249
|
-
[u, I,
|
|
250
|
-
),
|
|
251
|
+
[u, I, R, U, W]
|
|
252
|
+
), Rt = x(() => {
|
|
251
253
|
const t = c || [];
|
|
252
254
|
let e;
|
|
253
|
-
if (
|
|
254
|
-
e =
|
|
255
|
+
if (j)
|
|
256
|
+
e = je(t, A, Y);
|
|
255
257
|
else if (v && (A != null && A.length)) {
|
|
256
258
|
const n = {}, r = (h, S) => {
|
|
257
259
|
var H;
|
|
258
260
|
for (const m of h) {
|
|
259
|
-
const
|
|
260
|
-
typeof m.width == "number" && Number.isFinite(m.width) && (n[
|
|
261
|
+
const C = S ? `${S}/${m.id}` : m.id;
|
|
262
|
+
typeof m.width == "number" && Number.isFinite(m.width) && (n[C] = m.width), (H = m.children) != null && H.length && r(m.children, C);
|
|
261
263
|
}
|
|
262
264
|
};
|
|
263
|
-
r(A, ""), e =
|
|
265
|
+
r(A, ""), e = Mt(t, n, Y);
|
|
264
266
|
} else
|
|
265
267
|
e = t;
|
|
266
|
-
return v && Object.keys(
|
|
267
|
-
}, [c,
|
|
268
|
-
() =>
|
|
268
|
+
return v && Object.keys(k).length && (e = Mt(e, k, Y)), e;
|
|
269
|
+
}, [c, j, v, A, Y, k]), bt = x(
|
|
270
|
+
() => ke(
|
|
269
271
|
rt.current || c
|
|
270
272
|
),
|
|
271
273
|
// eslint-disable-next-line react-hooks/exhaustive-deps -- 随 columns 结构变
|
|
272
274
|
[c]
|
|
273
|
-
),
|
|
275
|
+
), Lt = z(
|
|
274
276
|
async (t) => {
|
|
275
|
-
const e =
|
|
276
|
-
await
|
|
277
|
+
const e = Me(t, i == null ? void 0 : i.columns);
|
|
278
|
+
await B(lt(i, { columns: e }));
|
|
277
279
|
},
|
|
278
|
-
[
|
|
280
|
+
[i, B]
|
|
279
281
|
), it = z(() => {
|
|
280
282
|
var t;
|
|
281
|
-
return (t =
|
|
283
|
+
return (t = i == null ? void 0 : i.columns) != null && t.length ? i.columns : Bt(
|
|
282
284
|
rt.current || c
|
|
283
285
|
);
|
|
284
|
-
}, [
|
|
286
|
+
}, [i, c]), vt = z((t, e) => {
|
|
285
287
|
const n = t.join("/");
|
|
286
288
|
Q((r) => {
|
|
287
289
|
const h = { ...r, [n]: e };
|
|
@@ -309,17 +311,17 @@ function nn({
|
|
|
309
311
|
async (t, e) => {
|
|
310
312
|
const n = t.join("/"), r = St(e, E, T), h = dt.current, S = { ...$.current, [n]: r };
|
|
311
313
|
h && h.querySelectorAll("[data-marsun-col-path]").forEach((m) => {
|
|
312
|
-
const
|
|
313
|
-
if (!
|
|
314
|
+
const C = m.getAttribute("data-marsun-col-path");
|
|
315
|
+
if (!C || C === n || S[C] != null) return;
|
|
314
316
|
const K = m.offsetWidth;
|
|
315
|
-
K > 0 && (S[
|
|
317
|
+
K > 0 && (S[C] = St(K, E, T));
|
|
316
318
|
}), S[n] = r, $.current = S, Q(S);
|
|
317
319
|
let H = it();
|
|
318
|
-
for (const [m,
|
|
319
|
-
H =
|
|
320
|
-
await
|
|
320
|
+
for (const [m, C] of Object.entries(S))
|
|
321
|
+
H = Be(H, m.split("/"), C, Y);
|
|
322
|
+
await B(lt(i, { columns: H }));
|
|
321
323
|
},
|
|
322
|
-
[it,
|
|
324
|
+
[it, B, i, T, E, Y]
|
|
323
325
|
), It = z(
|
|
324
326
|
async (t) => {
|
|
325
327
|
const e = t.join("/");
|
|
@@ -328,39 +330,39 @@ function nn({
|
|
|
328
330
|
const h = { ...r };
|
|
329
331
|
return delete h[e], $.current = h, h;
|
|
330
332
|
});
|
|
331
|
-
const n =
|
|
332
|
-
await
|
|
333
|
+
const n = De(it(), t);
|
|
334
|
+
await B(lt(i, { columns: n }));
|
|
333
335
|
},
|
|
334
|
-
[it,
|
|
336
|
+
[it, B, i]
|
|
335
337
|
), Et = z(
|
|
336
338
|
async (t) => {
|
|
337
339
|
var n;
|
|
338
340
|
if (!t.length) return;
|
|
339
|
-
const e = (n =
|
|
341
|
+
const e = (n = i == null ? void 0 : i.columns) != null && n.length && i.columns.length ? i.columns : Bt(
|
|
340
342
|
rt.current || c
|
|
341
343
|
);
|
|
342
|
-
await
|
|
344
|
+
await B(lt(i, { columns: Ue(e, t) }));
|
|
343
345
|
},
|
|
344
|
-
[
|
|
346
|
+
[i, c, B]
|
|
345
347
|
), Se = z(() => {
|
|
346
348
|
const t = (X || []).map(String);
|
|
347
|
-
t.length && J([...
|
|
348
|
-
}, [X,
|
|
349
|
+
t.length && J([...M, ...t]);
|
|
350
|
+
}, [X, M, J]), Ce = z(() => {
|
|
349
351
|
J([]);
|
|
350
352
|
}, [J]), Tt = z(
|
|
351
353
|
(t) => {
|
|
352
354
|
const e = String(t);
|
|
353
|
-
e && ((g || []).map(String).includes(e) || J([...
|
|
355
|
+
e && ((g || []).map(String).includes(e) || J([...M, e]));
|
|
354
356
|
},
|
|
355
|
-
[g,
|
|
357
|
+
[g, M, J]
|
|
356
358
|
), mt = x(() => {
|
|
357
|
-
let t =
|
|
358
|
-
if (
|
|
359
|
+
let t = Rt;
|
|
360
|
+
if (j && ht && (t = Yt(t, (n) => {
|
|
359
361
|
Et(n);
|
|
360
362
|
})), v && (t = Zt(t, {
|
|
361
363
|
minWidth: E,
|
|
362
364
|
maxWidth: T,
|
|
363
|
-
widthByPath:
|
|
365
|
+
widthByPath: k,
|
|
364
366
|
onResizeStartPath: _t,
|
|
365
367
|
onResizePath: vt,
|
|
366
368
|
onResizeStopPath: (n, r) => {
|
|
@@ -369,26 +371,29 @@ function nn({
|
|
|
369
371
|
onResetPath: (n) => {
|
|
370
372
|
It(n);
|
|
371
373
|
}
|
|
372
|
-
})), v && (Object.keys(
|
|
374
|
+
})), v && (Object.keys(k).length > 0 || $e(A))) {
|
|
373
375
|
const n = {
|
|
374
|
-
key:
|
|
376
|
+
key: qe,
|
|
375
377
|
title: "",
|
|
376
378
|
className: p.flexSpacerCol,
|
|
377
379
|
onHeaderCell: () => ({ className: p.flexSpacerCol }),
|
|
378
380
|
onCell: () => ({ className: p.flexSpacerCol }),
|
|
379
381
|
render: () => null
|
|
380
382
|
};
|
|
381
|
-
t =
|
|
383
|
+
t = Ge(
|
|
384
|
+
t,
|
|
385
|
+
n
|
|
386
|
+
);
|
|
382
387
|
}
|
|
383
|
-
if (
|
|
388
|
+
if (j && ht) {
|
|
384
389
|
const n = {
|
|
385
|
-
key:
|
|
390
|
+
key: Xe,
|
|
386
391
|
width: G,
|
|
387
392
|
fixed: "right",
|
|
388
393
|
align: "center",
|
|
389
|
-
className:
|
|
394
|
+
className: kt.configCol,
|
|
390
395
|
onHeaderCell: () => ({
|
|
391
|
-
className:
|
|
396
|
+
className: kt.configColHeader,
|
|
392
397
|
style: {
|
|
393
398
|
width: G,
|
|
394
399
|
minWidth: G,
|
|
@@ -407,9 +412,9 @@ function nn({
|
|
|
407
412
|
{
|
|
408
413
|
open: Ht,
|
|
409
414
|
onOpenChange: pe,
|
|
410
|
-
defaultItems:
|
|
415
|
+
defaultItems: bt,
|
|
411
416
|
savedConfig: A,
|
|
412
|
-
onConfirm:
|
|
417
|
+
onConfirm: Lt
|
|
413
418
|
}
|
|
414
419
|
),
|
|
415
420
|
render: () => null
|
|
@@ -418,14 +423,14 @@ function nn({
|
|
|
418
423
|
}
|
|
419
424
|
return t;
|
|
420
425
|
}, [
|
|
421
|
-
|
|
426
|
+
j,
|
|
422
427
|
v,
|
|
423
428
|
ht,
|
|
424
|
-
|
|
429
|
+
Rt,
|
|
425
430
|
Ht,
|
|
426
|
-
|
|
431
|
+
bt,
|
|
427
432
|
A,
|
|
428
|
-
|
|
433
|
+
Lt,
|
|
429
434
|
Et,
|
|
430
435
|
_t,
|
|
431
436
|
vt,
|
|
@@ -433,10 +438,10 @@ function nn({
|
|
|
433
438
|
It,
|
|
434
439
|
E,
|
|
435
440
|
T,
|
|
436
|
-
|
|
437
|
-
]),
|
|
441
|
+
k
|
|
442
|
+
]), We = x(() => b ? Qe(ut, M, typeof d == "function" || typeof d == "string" ? d : void 0, g) : ut, [b, ut, M, d, g]), xe = o === !1 ? !1 : {
|
|
438
443
|
showSizeChanger: !0,
|
|
439
|
-
showTotal:
|
|
444
|
+
showTotal: en,
|
|
440
445
|
...o && typeof o == "object" ? o : {},
|
|
441
446
|
...ct ? {
|
|
442
447
|
current: de,
|
|
@@ -447,44 +452,44 @@ function nn({
|
|
|
447
452
|
}
|
|
448
453
|
} : null
|
|
449
454
|
}, ze = {
|
|
450
|
-
...
|
|
451
|
-
emptyText: (
|
|
452
|
-
}, pt = x(() => new Set((g || []).map(String)), [g]), He =
|
|
455
|
+
...s,
|
|
456
|
+
emptyText: (s == null ? void 0 : s.emptyText) ?? (xt ? /* @__PURE__ */ y(Dt, { iconType: "simple", description: xt.message || "加载失败" }) : /* @__PURE__ */ y(Dt, { iconType: "simple", description: "暂无数据" }))
|
|
457
|
+
}, pt = x(() => new Set((g || []).map(String)), [g]), He = b && (X || []).some((t) => {
|
|
453
458
|
const e = String(t);
|
|
454
459
|
return e && !pt.has(e);
|
|
455
|
-
}), At =
|
|
460
|
+
}), At = b && M.length > 0, Oe = b && nt !== !1 ? /* @__PURE__ */ et(
|
|
456
461
|
ve,
|
|
457
462
|
{
|
|
458
463
|
size: "small",
|
|
459
464
|
className: at("marsun-table-row-config", p["marsun-table-row-config"]),
|
|
460
465
|
children: [
|
|
461
|
-
/* @__PURE__ */ y(
|
|
462
|
-
/* @__PURE__ */ et(
|
|
466
|
+
/* @__PURE__ */ y(jt, { size: "small", disabled: !He, onClick: Se, children: "隐藏选中行" }),
|
|
467
|
+
/* @__PURE__ */ et(jt, { size: "small", disabled: !At, onClick: Ce, children: [
|
|
463
468
|
"恢复隐藏行",
|
|
464
|
-
At ? `(${
|
|
469
|
+
At ? `(${M.length})` : ""
|
|
465
470
|
] })
|
|
466
471
|
]
|
|
467
472
|
}
|
|
468
473
|
) : null, Nt = nt === !1 ? null : nt !== void 0 ? nt : Oe, V = x(() => {
|
|
469
|
-
if (!
|
|
470
|
-
const t = typeof
|
|
474
|
+
if (!L || !b) return L;
|
|
475
|
+
const t = typeof L.columnWidth == "number" ? L.columnWidth : 48;
|
|
471
476
|
return {
|
|
472
|
-
...
|
|
477
|
+
...L,
|
|
473
478
|
columnWidth: t + 20,
|
|
474
479
|
renderCell: (e, n, r, h) => {
|
|
475
480
|
var K;
|
|
476
|
-
const H = ((K =
|
|
481
|
+
const H = ((K = L.renderCell) == null ? void 0 : K.call(L, e, n, r, h)) ?? h, m = nn(n, r, d), C = pt.has(m);
|
|
477
482
|
return /* @__PURE__ */ et("span", { className: p.rowSelectWithEye, children: [
|
|
478
483
|
H,
|
|
479
|
-
/* @__PURE__ */ y(Ut, { title:
|
|
484
|
+
/* @__PURE__ */ y(Ut, { title: C ? "主对标不可隐藏" : "隐藏此行", children: /* @__PURE__ */ y(
|
|
480
485
|
"button",
|
|
481
486
|
{
|
|
482
487
|
type: "button",
|
|
483
488
|
className: p.rowEyeBtn,
|
|
484
|
-
"aria-label":
|
|
485
|
-
disabled:
|
|
486
|
-
onClick: (
|
|
487
|
-
|
|
489
|
+
"aria-label": C ? "主对标不可隐藏" : "隐藏此行",
|
|
490
|
+
disabled: C,
|
|
491
|
+
onClick: (Le) => {
|
|
492
|
+
Le.stopPropagation(), Tt(m);
|
|
488
493
|
},
|
|
489
494
|
children: /* @__PURE__ */ y(Gt, { size: 14 })
|
|
490
495
|
}
|
|
@@ -492,21 +497,21 @@ function nn({
|
|
|
492
497
|
] });
|
|
493
498
|
}
|
|
494
499
|
};
|
|
495
|
-
}, [
|
|
500
|
+
}, [L, b, d, pt, Tt]), w = x(() => {
|
|
496
501
|
const t = qt(mt);
|
|
497
502
|
if (!t) return 0;
|
|
498
503
|
const e = V ? typeof V.columnWidth == "number" ? V.columnWidth : 48 : 0;
|
|
499
504
|
return t + e;
|
|
500
|
-
}, [mt, V]),
|
|
501
|
-
const t = f === void 0 ? { ...
|
|
505
|
+
}, [mt, V]), Re = x(() => {
|
|
506
|
+
const t = f === void 0 ? { ...Ke } : { ...f };
|
|
502
507
|
return w > 0 ? { ...t, x: w } : t;
|
|
503
|
-
}, [f, w]),
|
|
508
|
+
}, [f, w]), be = x(() => {
|
|
504
509
|
const t = Z == null ? void 0 : Z.header, e = t && "cell" in t ? t.cell : void 0;
|
|
505
510
|
return v ? {
|
|
506
511
|
...Z,
|
|
507
512
|
header: {
|
|
508
513
|
...t,
|
|
509
|
-
cell: (r) => !(typeof r.onResize == "function") && e ? /* @__PURE__ */ y(e, { ...r }) : /* @__PURE__ */ y(
|
|
514
|
+
cell: (r) => !(typeof r.onResize == "function") && e ? /* @__PURE__ */ y(e, { ...r }) : /* @__PURE__ */ y(Ye, { ...r })
|
|
510
515
|
}
|
|
511
516
|
} : Z;
|
|
512
517
|
}, [Z, v]);
|
|
@@ -515,48 +520,50 @@ function nn({
|
|
|
515
520
|
/* @__PURE__ */ y(
|
|
516
521
|
_e,
|
|
517
522
|
{
|
|
518
|
-
className: at("marsun-table", p["marsun-table"],
|
|
523
|
+
className: at("marsun-table", p["marsun-table"], l),
|
|
519
524
|
style: {
|
|
520
|
-
...
|
|
525
|
+
...a,
|
|
521
526
|
...w > 0 ? { "--marsun-table-scroll-x": `${w}px` } : null
|
|
522
527
|
},
|
|
523
|
-
scroll:
|
|
528
|
+
scroll: Re,
|
|
524
529
|
pagination: xe,
|
|
525
530
|
locale: ze,
|
|
526
531
|
columns: mt,
|
|
527
|
-
dataSource:
|
|
532
|
+
dataSource: We,
|
|
528
533
|
rowKey: d,
|
|
529
534
|
loading: me,
|
|
530
535
|
rowSelection: V,
|
|
531
|
-
components:
|
|
536
|
+
components: be,
|
|
532
537
|
...le
|
|
533
538
|
}
|
|
534
539
|
)
|
|
535
540
|
] });
|
|
536
541
|
}
|
|
537
|
-
const
|
|
542
|
+
const zn = Pe(sn);
|
|
538
543
|
export {
|
|
539
|
-
|
|
544
|
+
Xe as COLUMN_CONFIG_COL_KEY,
|
|
540
545
|
Ae as COLUMN_RESIZE_MAX_WIDTH,
|
|
541
546
|
Ne as COLUMN_RESIZE_MIN_WIDTH,
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
547
|
+
qe as FLEX_SPACER_COL_KEY,
|
|
548
|
+
je as applyColumnConfig,
|
|
549
|
+
Qe as applyHiddenRows,
|
|
550
|
+
Mt as applyLeafWidthOverrides,
|
|
546
551
|
St as clampColumnWidth,
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
552
|
+
De as clearColumnWidthAtPath,
|
|
553
|
+
Fe as columnsLeafPathSignature,
|
|
554
|
+
Bt as columnsToConfig,
|
|
550
555
|
$e as configHasLeafWidths,
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
556
|
+
Me as copyColumnWidths,
|
|
557
|
+
zn as default,
|
|
558
|
+
Je as emptyTablePrefs,
|
|
554
559
|
Ue as hideColumnAtPath,
|
|
555
|
-
|
|
560
|
+
Ge as insertBeforeFixedRight,
|
|
561
|
+
Ze as isFixedColumn,
|
|
562
|
+
Wt as isInternalColumnKey,
|
|
556
563
|
lt as mergeTablePrefs,
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
564
|
+
Ct as normalizeHiddenRowKeys,
|
|
565
|
+
Rn as parseTablePrefs,
|
|
566
|
+
bn as serializeTablePrefs,
|
|
567
|
+
Be as setColumnWidthAtPath
|
|
561
568
|
};
|
|
562
569
|
//# sourceMappingURL=Table.js.map
|