@hkyhy/marsun-components-core 0.1.78 → 0.1.81

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