@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.
@@ -1,274 +1,420 @@
1
- import { jsx as d, jsxs as D } from "react/jsx-runtime";
2
- import { Space as ee, Button as gt, Tooltip as vt, Table as ne } from "antd";
3
- import $ from "classnames";
4
- import { forwardRef as re, useImperativeHandle as se, useRef as le, useState as U, useEffect as yt, useMemo as L, useCallback as W } from "react";
5
- import St from "./columnConfig.module.scss.js";
6
- import { ColumnConfigTrigger as ie } from "./ColumnConfigPanel.js";
7
- import { applyColumnConfig as ae, columnsToPanelItems as ce, columnsToConfig as oe, hideColumnAtPath as ue, COLUMN_CONFIG_COL_KEY as de, isInternalColumnKey as xt, shortChildId as me } from "./columnConfigUtils.js";
8
- import { FLEX_SPACER_COL_KEY as $e } from "./columnConfigUtils.js";
9
- import m from "./style.module.scss.js";
10
- import { emptyTablePrefs as fe } from "./tablePrefsTypes.js";
11
- import { normalizeHiddenRowKeys as K, mergeTablePrefs as Lt, applyHiddenRows as he } from "./tablePrefsUtils.js";
12
- import { parseTablePrefs as Xe, serializeTablePrefs as Ye } from "./tablePrefsUtils.js";
13
- import { useTableFetch as pe } from "./useTableFetch.js";
14
- import { useMarsunFetch as ge } from "../../provider/context.js";
15
- import _t from "../Empty/Empty.js";
16
- import { Eye as Ht } from "../Icons/Eye.js";
17
- const ye = { x: "max-content" }, b = 40, Se = 64;
18
- function Le(e) {
19
- return `共 ${e} 项`;
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 It(e) {
22
- var i;
23
- if (!(e != null && e.length)) return 0;
24
- let c = 0;
25
- for (const r of e) {
26
- const f = r.key != null ? String(r.key) : "";
27
- if (f && xt(f)) continue;
28
- if ((i = r.children) != null && i.length) {
29
- c += It(r.children);
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 l = r.width;
33
- typeof l == "number" && Number.isFinite(l) && l > 0 ? c += l : c += Se;
33
+ const c = o.width;
34
+ typeof c == "number" && Number.isFinite(c) && c > 0 ? a += c : a += tn;
34
35
  }
35
- return c;
36
+ return a;
36
37
  }
37
- function _e(e, c) {
38
- return e.key != null && String(e.key) !== "" ? String(e.key) : e.dataIndex != null ? Array.isArray(e.dataIndex) ? e.dataIndex.join(".") : String(e.dataIndex) : `__col_${c}`;
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 ve(e, c, i) {
41
- if (typeof i == "function") return String(i(e, c));
42
- if (typeof i == "string" && i) {
43
- const r = e[i];
44
- if (r != null && r !== "") return String(r);
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(c);
47
+ return String(a);
47
48
  }
48
- const xe = 6;
49
- function Ot(e, c, i, r = [], f = 0, l) {
50
- let k = 0;
51
- return e.map((s, G) => {
52
- var o, _;
53
- const a = _e(s, G);
54
- if (xt(a)) return s;
55
- const X = i ? me(i, a) : a, H = [...r, X], I = s.onHeaderCell;
56
- let p = l;
57
- f === 0 && (p = (o = s.children) != null && o.length ? k++ : void 0);
58
- const E = p == null ? void 0 : f === 0 ? m.headerDepth0 : f === 1 ? m.headerDepth1 : m.headerDepth2, F = p == null ? void 0 : m[`headerGroup${p % xe}`], O = /* @__PURE__ */ D("span", { className: m.headerTitleWithEye, children: [
59
- /* @__PURE__ */ d("span", { className: m.headerTitleText, children: s.title }),
60
- /* @__PURE__ */ d(vt, { title: "隐藏此列", children: /* @__PURE__ */ d(
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: m.headerEyeBtn,
100
+ className: p.headerEyeBtn,
65
101
  "aria-label": "隐藏此列",
66
- onClick: (v) => {
67
- v.stopPropagation(), c(H);
102
+ onClick: (F) => {
103
+ F.stopPropagation(), a(P);
68
104
  },
69
- children: /* @__PURE__ */ d(Ht, { size: 12 })
105
+ children: /* @__PURE__ */ y(Gt, { size: 12 })
70
106
  }
71
107
  ) })
72
- ] }), g = (v) => {
73
- const C = typeof I == "function" ? I(v) : I || {};
108
+ ] }), b = (F) => {
109
+ const X = typeof R == "function" ? R(F) : R || {};
74
110
  return {
75
- ...C,
76
- className: $(C.className, F, E)
111
+ ...X,
112
+ className: at(X.className, I, D)
77
113
  };
78
114
  };
79
- return (_ = s.children) != null && _.length ? {
80
- ...s,
81
- title: O,
82
- onHeaderCell: g,
83
- children: Ot(
84
- s.children,
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
- H,
88
- f + 1,
89
- p
122
+ u,
123
+ P,
124
+ s + 1,
125
+ W
90
126
  )
91
127
  } : {
92
- ...s,
93
- title: O,
94
- onHeaderCell: g
128
+ ...d,
129
+ title: U,
130
+ onHeaderCell: b
95
131
  };
96
132
  });
97
133
  }
98
- function He({
99
- className: e,
100
- style: c,
101
- scroll: i,
102
- pagination: r,
103
- locale: f,
104
- columns: l,
105
- dataSource: k,
106
- rowKey: s,
107
- loading: G,
108
- tableName: a,
109
- columnConfigEnabled: X,
110
- fetchColumnConfig: H,
111
- saveColumnConfig: I,
112
- onColumnConfigChange: p,
113
- fetchTablePrefs: E,
114
- saveTablePrefs: F,
115
- onTablePrefsChange: O,
116
- rowConfigEnabled: g = !1,
117
- lockedRowKeys: o,
118
- hiddenRowKeys: _,
119
- onHiddenRowKeysChange: v,
120
- rowHideSelectedKeys: C,
121
- rowConfigToolbar: M,
122
- rowSelection: y,
123
- fetchData: Tt,
124
- fetchUrl: Wt,
125
- fetchOptions: bt,
126
- transformData: Et,
127
- fetchParams: Ct,
128
- enabled: At = !0,
129
- defaultPageSize: Ft = 20,
130
- onFetched: Nt,
131
- ...zt
132
- }, Dt) {
133
- var mt;
134
- const Y = ge(), {
135
- fetchMode: q,
136
- rows: kt,
137
- total: Mt,
138
- loading: jt,
139
- error: tt,
140
- currentPage: Bt,
141
- pageSize: Pt,
142
- setPage: Ut,
143
- reload: et
144
- } = pe({
145
- dataSource: k,
146
- fetchData: Tt,
147
- fetchUrl: Wt,
148
- fetchOptions: bt,
149
- transformData: Et,
150
- fetchParams: Ct,
151
- enabled: At,
152
- defaultPageSize: Ft,
153
- baseUrl: Y.baseUrl,
154
- defaultHeaders: Y.headers,
155
- timeoutMs: Y.timeoutMs,
156
- onFetched: Nt
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
- se(Dt, () => ({ reload: et }), [et]);
159
- const Z = q ? kt : k, $t = !!G || q && jt, T = X ?? !!a, J = le(l), [u, j] = U(null), [nt, Gt] = U(!1), [rt, Q] = U(!T), [st, Xt] = U([]);
160
- yt(() => {
161
- J.current = l;
162
- }, [l]), yt(() => {
163
- if (!T || !a || !(E || H)) {
164
- Q(!0);
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 Q(!1), (async () => {
169
- var S;
218
+ return ft(!1), (async () => {
219
+ var n;
170
220
  try {
171
- if (E) {
172
- const h = await E(a);
173
- t || j((S = h == null ? void 0 : h.columns) != null && S.length ? h : null);
174
- } else if (H) {
175
- const h = await H(a);
176
- t || j(h != null && h.length ? fe(h) : null);
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 || j(null);
229
+ t || st(null);
180
230
  } finally {
181
- t || Q(!0);
231
+ t || ft(!0);
182
232
  }
183
233
  })(), () => {
184
234
  t = !0;
185
235
  };
186
- }, [T, a, E, H]);
187
- const B = (mt = u == null ? void 0 : u.columns) != null && mt.length ? u.columns : null, x = L(() => _ !== void 0 ? K(_, o) : K(st, o), [_, st, o]), A = W(
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 n = K(t, o);
190
- _ === void 0 && Xt(n), v == null || v(n);
239
+ const e = Ct(t, g);
240
+ N === void 0 && ye(e), F == null || F(e);
191
241
  },
192
- [_, o, v]
193
- ), P = W(
242
+ [N, g, F]
243
+ ), B = z(
194
244
  async (t) => {
195
- if (j(t), O == null || O(t), p == null || p(t.columns), a && F) {
196
- await F(a, t);
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
- a && I && await I(a, t.columns);
249
+ u && R && await R(u, t.columns);
200
250
  },
201
- [a, F, I, O, p]
202
- ), lt = L(() => {
203
- const t = l || [];
204
- return T ? ae(t, B) : t;
205
- }, [l, T, B]), it = L(
206
- () => ce(
207
- J.current || l
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
- [l]
211
- ), at = W(
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
- await P(Lt(u, { columns: t }));
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
- [u, P]
216
- ), ct = W(
336
+ [it, B, i]
337
+ ), Et = z(
217
338
  async (t) => {
218
- var S;
339
+ var n;
219
340
  if (!t.length) return;
220
- const n = (S = u == null ? void 0 : u.columns) != null && S.length && u.columns.length ? u.columns : oe(
221
- J.current || l
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 P(Lt(u, { columns: ue(n, t) }));
344
+ await B(lt(i, { columns: Ue(e, t) }));
224
345
  },
225
- [u, l, P]
226
- ), Yt = W(() => {
227
- const t = (C || []).map(String);
228
- t.length && A([...x, ...t]);
229
- }, [C, x, A]), qt = W(() => {
230
- A([]);
231
- }, [A]), ot = W(
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 n = String(t);
234
- n && ((o || []).map(String).includes(n) || A([...x, n]));
354
+ const e = String(t);
355
+ e && ((g || []).map(String).includes(e) || J([...M, e]));
235
356
  },
236
- [o, x, A]
237
- ), R = L(() => {
238
- let t = lt;
239
- if (T && rt) {
240
- t = Ot(t, (S) => {
241
- ct(S);
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: de,
245
- width: b,
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: St.configCol,
394
+ className: kt.configCol,
249
395
  onHeaderCell: () => ({
250
- className: St.configColHeader,
396
+ className: kt.configColHeader,
251
397
  style: {
252
- width: b,
253
- minWidth: b,
254
- maxWidth: b
398
+ width: G,
399
+ minWidth: G,
400
+ maxWidth: G
255
401
  }
256
402
  }),
257
403
  onCell: () => ({
258
404
  style: {
259
- width: b,
260
- minWidth: b,
261
- maxWidth: b
405
+ width: G,
406
+ minWidth: G,
407
+ maxWidth: G
262
408
  }
263
409
  }),
264
- title: /* @__PURE__ */ d(
265
- ie,
410
+ title: /* @__PURE__ */ y(
411
+ Te,
266
412
  {
267
- open: nt,
268
- onOpenChange: Gt,
269
- defaultItems: it,
270
- savedConfig: B,
271
- onConfirm: at
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
- rt,
282
- lt,
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: Le,
291
- ...r && typeof r == "object" ? r : {},
292
- ...q ? {
293
- current: Bt,
294
- pageSize: Pt,
295
- total: Mt,
296
- onChange: (t, n) => {
297
- Ut(t, n), r && typeof r == "object" && r.onChange && r.onChange(t, n);
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
- }, Qt = {
301
- ...f,
302
- emptyText: (f == null ? void 0 : f.emptyText) ?? (tt ? /* @__PURE__ */ d(_t, { iconType: "simple", description: tt.message || "加载失败" }) : /* @__PURE__ */ d(_t, { iconType: "simple", description: "暂无数据" }))
303
- }, V = L(() => new Set((o || []).map(String)), [o]), Rt = g && (C || []).some((t) => {
304
- const n = String(t);
305
- return n && !V.has(n);
306
- }), ut = g && x.length > 0, Vt = g && M !== !1 ? /* @__PURE__ */ D(
307
- ee,
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: $("marsun-table-row-config", m["marsun-table-row-config"]),
464
+ className: at("marsun-table-row-config", p["marsun-table-row-config"]),
311
465
  children: [
312
- /* @__PURE__ */ d(gt, { size: "small", disabled: !Rt, onClick: Yt, children: "隐藏选中行" }),
313
- /* @__PURE__ */ D(gt, { size: "small", disabled: !ut, onClick: qt, children: [
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
- ut ? `(${x.length})` : ""
469
+ At ? `(${M.length})` : ""
316
470
  ] })
317
471
  ]
318
472
  }
319
- ) : null, dt = M === !1 ? null : M !== void 0 ? M : Vt, N = L(() => {
320
- if (!y || !g) return y;
321
- const t = typeof y.columnWidth == "number" ? y.columnWidth : 48;
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
- ...y,
477
+ ...L,
324
478
  columnWidth: t + 20,
325
- renderCell: (n, S, h, ft) => {
326
- var pt;
327
- const Kt = ((pt = y.renderCell) == null ? void 0 : pt.call(y, n, S, h, ft)) ?? ft, ht = ve(S, h, s), w = V.has(ht);
328
- return /* @__PURE__ */ D("span", { className: m.rowSelectWithEye, children: [
329
- Kt,
330
- /* @__PURE__ */ d(vt, { title: w ? "主对标不可隐藏" : "隐藏此行", children: /* @__PURE__ */ d(
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: m.rowEyeBtn,
335
- "aria-label": w ? "主对标不可隐藏" : "隐藏此行",
336
- disabled: w,
337
- onClick: (te) => {
338
- te.stopPropagation(), ot(ht);
488
+ className: p.rowEyeBtn,
489
+ "aria-label": C ? "主对标不可隐藏" : "隐藏此行",
490
+ disabled: C,
491
+ onClick: (Le) => {
492
+ Le.stopPropagation(), Tt(m);
339
493
  },
340
- children: /* @__PURE__ */ d(Ht, { size: 14 })
494
+ children: /* @__PURE__ */ y(Gt, { size: 14 })
341
495
  }
342
496
  ) })
343
497
  ] });
344
498
  }
345
499
  };
346
- }, [y, g, s, V, ot]), z = L(() => {
347
- const t = It(R);
500
+ }, [L, b, d, pt, Tt]), w = x(() => {
501
+ const t = qt(mt);
348
502
  if (!t) return 0;
349
- const n = N ? typeof N.columnWidth == "number" ? N.columnWidth : 48 : 0;
350
- return t + n;
351
- }, [R, N]), wt = L(() => {
352
- const t = i === void 0 ? { ...ye } : { ...i };
353
- return z > 0 ? { ...t, x: z } : t;
354
- }, [i, z]);
355
- return /* @__PURE__ */ D("div", { className: $("marsun-table-shell", m["marsun-table-shell"]), children: [
356
- dt ? /* @__PURE__ */ d("div", { className: m["marsun-table-toolbar"], children: dt }) : null,
357
- /* @__PURE__ */ d(
358
- ne,
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: $("marsun-table", m["marsun-table"], e),
523
+ className: at("marsun-table", p["marsun-table"], l),
361
524
  style: {
362
- ...c,
363
- ...z > 0 ? { "--marsun-table-scroll-x": `${z}px` } : null
525
+ ...a,
526
+ ...w > 0 ? { "--marsun-table-scroll-x": `${w}px` } : null
364
527
  },
365
- scroll: wt,
366
- pagination: Jt,
367
- locale: Qt,
368
- columns: R,
369
- dataSource: Zt,
370
- rowKey: s,
371
- loading: $t,
372
- rowSelection: N,
373
- ...zt
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 Be = re(He);
542
+ const zn = Pe(sn);
379
543
  export {
380
- de as COLUMN_CONFIG_COL_KEY,
381
- $e as FLEX_SPACER_COL_KEY,
382
- ae as applyColumnConfig,
383
- he as applyHiddenRows,
384
- oe as columnsToConfig,
385
- Be as default,
386
- fe as emptyTablePrefs,
387
- ue as hideColumnAtPath,
388
- xt as isInternalColumnKey,
389
- Lt as mergeTablePrefs,
390
- K as normalizeHiddenRowKeys,
391
- Xe as parseTablePrefs,
392
- Ye as serializeTablePrefs
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