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