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