bj-web-components 0.2.23 → 0.2.25

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,348 +1,380 @@
1
- import { jsxs as k, jsx as f } from "react/jsx-runtime";
2
- import { useRef as ne, useMemo as Z, useState as D, useEffect as C, createElement as Ke, isValidElement as Zt } from "react";
3
- import { createPortal as Xt } from "react-dom";
4
- import Yt from "../Pagination/Pagination.mjs";
5
- import Be from "../Icon/Icon.mjs";
1
+ import { jsxs as E, jsx as b } from "react/jsx-runtime";
2
+ import { useRef as de, useMemo as X, useState as R, useEffect as Y, createElement as Me, isValidElement as ar } from "react";
3
+ import { createPortal as nr } from "react-dom";
4
+ import sr from "../Pagination/Pagination.mjs";
5
+ import Le from "../Icon/Icon.mjs";
6
6
  /* empty css */
7
- import Ct from "../Tooltip/ContentTooltip.mjs";
8
- import er from "../Tooltip/TooltipWrapper.mjs";
9
- import { BCheckBox as tr } from "../CheckBox/index.mjs";
10
- import { BDropdown as rr } from "../Dropdown/BDropdown.mjs";
11
- import ir from "../OverlayScrollbar/BOverlayScrollbar.mjs";
12
- import ar from "../SkuInputCard/spin_loading_red.gif.mjs";
13
- import sr from "../ProductField/no_data_light.svg.mjs";
14
- import nr from "./Column.mjs";
15
- import lr from "./ColumnGroup.mjs";
16
- import { getColumnKey as E, filterRecords as dt, sortRecords as ct, renderColumnTitle as ft, getNextSortOrder as dr, getSorterResult as cr } from "./utils/sortFilter.mjs";
17
- import { convertChildrenToColumns as fr, flattenColumns as br, buildHeaderRows as hr } from "./utils/columns.mjs";
7
+ import lr from "../Tooltip/ContentTooltip.mjs";
8
+ import dr from "../Tooltip/TooltipWrapper.mjs";
9
+ import { BCheckBox as fr } from "../CheckBox/index.mjs";
10
+ import { BDropdown as cr } from "../Dropdown/BDropdown.mjs";
11
+ import br from "../OverlayScrollbar/BOverlayScrollbar.mjs";
12
+ import hr from "../SkuInputCard/spin_loading_red.gif.mjs";
13
+ import or from "../ProductField/no_data_light.svg.mjs";
14
+ import _r from "./Column.mjs";
15
+ import ur from "./ColumnGroup.mjs";
16
+ import { getColumnKey as O, filterRecords as yt, sortRecords as jt, renderColumnTitle as mt, getNextSortOrder as yr, getSorterResult as jr } from "./utils/sortFilter.mjs";
17
+ import { convertChildrenToColumns as mr, flattenColumns as gr, buildHeaderRows as pr } from "./utils/columns.mjs";
18
18
  /* empty css */
19
- const or = 300;
20
- function S(...u) {
21
- return u.filter(Boolean).join(" ");
19
+ const vr = 300, Te = 1;
20
+ function L(...m) {
21
+ return m.filter(Boolean).join(" ");
22
22
  }
23
- function ur(u, o) {
24
- return o === void 0 ? void 0 : (Array.isArray(o) ? o : [o]).reduce((F, l) => {
25
- if (!(F == null || typeof F != "object"))
26
- return F[l];
27
- }, u);
23
+ function xr(m, j) {
24
+ return j === void 0 ? void 0 : (Array.isArray(j) ? j : [j]).reduce((D, d) => {
25
+ if (!(D == null || typeof D != "object"))
26
+ return D[d];
27
+ }, m);
28
28
  }
29
- function L(u, o, _) {
30
- if (typeof _ == "function")
31
- return _(u, o);
32
- if (_) {
33
- const F = u[String(_)];
34
- if (typeof F == "string" || typeof F == "number")
35
- return F;
29
+ function q(m, j, g) {
30
+ if (typeof g == "function")
31
+ return g(m, j);
32
+ if (g) {
33
+ const D = m[String(g)];
34
+ if (typeof D == "string" || typeof D == "number")
35
+ return D;
36
36
  }
37
- return o;
37
+ return j;
38
38
  }
39
- function _r(u, o) {
40
- return Math.max(1, Math.ceil(u / o));
39
+ function Nr(m, j) {
40
+ return Math.max(1, Math.ceil(m / j));
41
41
  }
42
- function yr(u) {
43
- return !!(u && typeof u == "object" && !Zt(u) && "props" in u);
42
+ function Rr(m) {
43
+ return !!(m && typeof m == "object" && !ar(m) && "props" in m);
44
44
  }
45
- function jr(u, o) {
46
- return (typeof o.text == "string" || typeof o.text == "number" ? String(o.text) : String(o.value)).toLocaleLowerCase().includes(u.toLocaleLowerCase());
45
+ function Fr(m, j) {
46
+ return (typeof j.text == "string" || typeof j.text == "number" ? String(j.text) : String(j.value)).toLocaleLowerCase().includes(m.toLocaleLowerCase());
47
47
  }
48
- function bt({
49
- checked: u,
50
- disabled: o,
51
- label: _,
52
- name: F,
53
- onChange: l,
48
+ function gt({
49
+ checked: m,
50
+ disabled: j,
51
+ label: g,
52
+ name: D,
53
+ onChange: d,
54
54
  type: A = "checkbox"
55
55
  }) {
56
- return A === "checkbox" ? /* @__PURE__ */ f(
57
- tr,
56
+ return A === "checkbox" ? /* @__PURE__ */ b(
57
+ fr,
58
58
  {
59
- "aria-label": _,
60
- checked: u,
59
+ "aria-label": g,
60
+ checked: m,
61
61
  className: "bj-table__selection-checkbox",
62
- disabled: o,
63
- name: F,
64
- onChange: l,
62
+ disabled: j,
63
+ name: D,
64
+ onChange: d,
65
65
  skipGroup: !0
66
66
  }
67
- ) : /* @__PURE__ */ k("label", { className: S("bj-table__selection-control", u && "bj-table__selection-control--checked", o && "bj-table__selection-control--disabled"), children: [
68
- /* @__PURE__ */ f(
67
+ ) : /* @__PURE__ */ E("label", { className: L("bj-table__selection-control", m && "bj-table__selection-control--checked", j && "bj-table__selection-control--disabled"), children: [
68
+ /* @__PURE__ */ b(
69
69
  "input",
70
70
  {
71
- "aria-label": _,
72
- checked: u,
71
+ "aria-label": g,
72
+ checked: m,
73
73
  className: "bj-table__selection-input",
74
- disabled: o,
75
- name: F,
76
- onChange: l,
74
+ disabled: j,
75
+ name: D,
76
+ onChange: d,
77
77
  type: A
78
78
  }
79
79
  ),
80
- /* @__PURE__ */ f("span", { "aria-hidden": "true", className: "bj-table__selection-box", children: u && /* @__PURE__ */ f(Be, { className: "bj-table__selection-check-icon", type: "icon-a-dagouxi" }) })
80
+ /* @__PURE__ */ b("span", { "aria-hidden": "true", className: "bj-table__selection-box", children: m && /* @__PURE__ */ b(Le, { className: "bj-table__selection-check-icon", type: "icon-a-dagouxi" }) })
81
81
  ] });
82
82
  }
83
- function pr({
84
- columns: u,
85
- dataSource: o = [],
86
- rowKey: _,
87
- preserveSelectedRowKeys: F = !1,
88
- rowSelection: l,
83
+ function Dr({
84
+ columns: m,
85
+ dataSource: j = [],
86
+ rowKey: g,
87
+ preserveSelectedRowKeys: D = !1,
88
+ rowSelection: d,
89
89
  pagination: A = !1,
90
- loading: ue = !1,
91
- bordered: ot = !0,
92
- size: ut = "middle",
93
- showHeader: _t = !0,
94
- emptyText: _e,
95
- emptyImage: ye = sr,
96
- emptyHeight: yt,
97
- t: X = (le) => le,
98
- className: jt,
99
- style: pt,
100
- rowClassName: je,
101
- sortDirections: mt = ["ascend", "descend", null],
90
+ loading: ye = !1,
91
+ bordered: vt = !0,
92
+ size: xt = "middle",
93
+ showHeader: Ie = !0,
94
+ emptyText: je,
95
+ emptyImage: me = or,
96
+ emptyHeight: Nt,
97
+ t: C = (fe) => fe,
98
+ className: Rt,
99
+ style: Ft,
100
+ rowClassName: ge,
101
+ sortDirections: Dt = ["ascend", "descend", null],
102
102
  onChange: pe,
103
- children: ze,
104
- title: Me,
105
- footer: Te,
106
- summary: Ie,
107
- tableLayout: Se,
108
- components: x,
109
- onRow: me,
110
- onHeaderRow: ve,
111
- id: vt,
112
- scroll: b,
113
- locale: Y,
103
+ children: Ve,
104
+ title: we,
105
+ footer: Ge,
106
+ summary: qe,
107
+ tableLayout: ve,
108
+ components: N,
109
+ onRow: xe,
110
+ onHeaderRow: Ne,
111
+ id: Et,
112
+ scroll: f,
113
+ locale: ee,
114
114
  groupCollapse: h
115
115
  }) {
116
- var at, st, nt;
117
- const le = ne(null), Ve = ne(null), de = Z(
118
- () => u ?? fr(ze),
119
- [ze, u]
120
- ), ee = Z(() => br(de), [de]), we = Z(() => hr(de), [de]), [gt, Ge] = D(
121
- (l == null ? void 0 : l.defaultSelectedRowKeys) ?? []
122
- ), [ge, ce] = D(
116
+ var ht, ot, _t;
117
+ const fe = de(null), Re = de(null), ce = X(
118
+ () => m ?? mr(Ve),
119
+ [Ve, m]
120
+ ), re = X(() => gr(ce), [ce]), Ae = X(() => pr(ce), [ce]), [Pt, We] = R(
121
+ (d == null ? void 0 : d.defaultSelectedRowKeys) ?? []
122
+ ), [Fe, be] = R(
123
123
  A ? A.defaultCurrent ?? 1 : 1
124
- ), [xt, Nt] = D(
124
+ ), [kt, Ot] = R(
125
125
  A ? A.defaultPageSize ?? 10 : 10
126
- ), [Ft, Dt] = D(
127
- () => new Map(ee.flatMap((e, t) => e.defaultSortOrder ? [[E(e, t), e.defaultSortOrder]] : []))
128
- ), [kt, Pt] = D(
129
- () => new Map(ee.flatMap((e, t) => e.defaultFilteredValue === void 0 ? [] : [[E(e, t), e.defaultFilteredValue]]))
130
- ), [Rt, Ot] = D(
126
+ ), [Bt, Kt] = R(
127
+ () => new Map(re.flatMap((e, t) => e.defaultSortOrder ? [[O(e, t), e.defaultSortOrder]] : []))
128
+ ), [St, zt] = R(
129
+ () => new Map(re.flatMap((e, t) => e.defaultFilteredValue === void 0 ? [] : [[O(e, t), e.defaultFilteredValue]]))
130
+ ), [Mt, Tt] = R(
131
131
  h != null && h.defaultExpandedKeys ? [...h.defaultExpandedKeys] : []
132
- ), [V, W] = D(null), [Le, te] = D(/* @__PURE__ */ new Map()), [Et, fe] = D(null), Kt = ne(`btable-${Math.random().toString(36).slice(2, 10)}`).current, [$, xe] = D(null), [Ne, Ae] = D(null), [Fe, qe] = D(""), [re, He] = D(""), [Bt, De] = D(), ke = ne(0), Pe = ne(!1), i = A || void 0, q = (i == null ? void 0 : i.pageSize) ?? xt, K = (l == null ? void 0 : l.selectedRowKeys) ?? gt, v = ee, P = new Map(Ft), B = new Map(kt);
133
- v.forEach((e, t) => {
132
+ ), [I, U] = R(null), [$e, ie] = R(/* @__PURE__ */ new Map()), [Lt, he] = R(null), It = de(`btable-${Math.random().toString(36).slice(2, 10)}`).current, [J, De] = R(null), [Ee, He] = R(null), [Pe, Ue] = R(""), [ae, Je] = R(""), [Vt, ke] = R(), Oe = de(0), Be = de(!1), [Qe, Ze] = R({ start: 0, end: 0 }), [Xe, Ye] = R({ start: !1, end: !1 }), n = A || void 0, W = (n == null ? void 0 : n.pageSize) ?? kt, B = (d == null ? void 0 : d.selectedRowKeys) ?? Pt, y = re, wt = `${y.map((e) => `${String(e.fixed ?? "")}:${String(e.width ?? "")}`).join("|")}|${d ? String(d.columnWidth ?? "") : "-"}|${String((f == null ? void 0 : f.x) ?? "")}|${String(ve ?? "")}`, $ = (e) => !!(e && (e.fixed === "left" || e.fixed === !0)), te = (e) => !!(e && e.fixed === "right"), P = new Map(Bt), K = new Map(St);
133
+ y.forEach((e, t) => {
134
134
  if ("children" in e) return;
135
- const r = E(e, t);
136
- e.sortOrder !== void 0 && P.set(r, e.sortOrder), e.filteredValue !== void 0 && B.set(r, e.filteredValue);
135
+ const r = O(e, t);
136
+ e.sortOrder !== void 0 && P.set(r, e.sortOrder), e.filteredValue !== void 0 && K.set(r, e.filteredValue);
137
137
  });
138
- const Ue = Z(
139
- () => dt(o, v, B),
140
- [v, B, o]
141
- ), z = Z(
142
- () => ct(Ue, v, P),
143
- [v, Ue, P]
144
- ), We = (i == null ? void 0 : i.total) ?? z.length, $e = _r(We, q), H = Math.min((i == null ? void 0 : i.current) ?? ge, $e), J = (h == null ? void 0 : h.expandedKeys) ?? Rt, ie = (e, t) => h != null && h.isGroupRow ? h.isGroupRow(e, t) : !!e.isGroup, be = (e, t) => h != null && h.groupKey ? h.groupKey(e, t) : e.groupId, Je = (e, t) => h != null && h.childrenKeys ? h.childrenKeys(e, t) : e.childrenIds ?? [], zt = (e, t) => {
145
- var c;
146
- const r = be(e, t), s = J.includes(r), d = s ? J.filter((a) => a !== r) : [...J, r];
147
- (h == null ? void 0 : h.expandedKeys) === void 0 && Ot(d), (c = h == null ? void 0 : h.onExpandedKeysChange) == null || c.call(h, d, e, !s);
138
+ const Ce = X(
139
+ () => yt(j, y, K),
140
+ [y, K, j]
141
+ ), S = X(
142
+ () => jt(Ce, y, P),
143
+ [y, Ce, P]
144
+ ), et = (n == null ? void 0 : n.total) ?? S.length, tt = Nr(et, W), H = Math.min((n == null ? void 0 : n.current) ?? Fe, tt), Q = (h == null ? void 0 : h.expandedKeys) ?? Mt, ne = (e, t) => h != null && h.isGroupRow ? h.isGroupRow(e, t) : !!e.isGroup, oe = (e, t) => h != null && h.groupKey ? h.groupKey(e, t) : e.groupId, rt = (e, t) => h != null && h.childrenKeys ? h.childrenKeys(e, t) : e.childrenIds ?? [], Gt = (e, t) => {
145
+ var a;
146
+ const r = oe(e, t), s = Q.includes(r), l = s ? Q.filter((i) => i !== r) : [...Q, r];
147
+ (h == null ? void 0 : h.expandedKeys) === void 0 && Tt(l), (a = h == null ? void 0 : h.onExpandedKeysChange) == null || a.call(h, l, e, !s);
148
148
  };
149
- C(() => {
150
- H !== ge && (i == null ? void 0 : i.current) === void 0 && ce(H);
151
- }, [H, i == null ? void 0 : i.current, ge]), C(() => {
152
- if (!$ || V === null) {
153
- Ae(null);
149
+ Y(() => {
150
+ H !== Fe && (n == null ? void 0 : n.current) === void 0 && be(H);
151
+ }, [H, n == null ? void 0 : n.current, Fe]), Y(() => {
152
+ if (!J || I === null) {
153
+ He(null);
154
154
  return;
155
155
  }
156
156
  const e = () => {
157
- const t = $.getBoundingClientRect();
158
- Ae({ left: t.left, top: t.bottom + 4 });
157
+ const t = J.getBoundingClientRect();
158
+ He({ left: t.left, top: t.bottom + 4 });
159
159
  };
160
160
  return e(), document.addEventListener("scroll", e, !0), window.addEventListener("resize", e), () => {
161
161
  document.removeEventListener("scroll", e, !0), window.removeEventListener("resize", e);
162
162
  };
163
- }, [$, V]), C(() => {
164
- if (V === null) return;
163
+ }, [J, I]), Y(() => {
164
+ if (I === null) return;
165
165
  const e = (t) => {
166
166
  const r = t.target;
167
- $ != null && $.contains(r) || r.closest(".bj-table__filter-dropdown") || (W(null), xe(null));
167
+ J != null && J.contains(r) || r.closest(".bj-table__filter-dropdown") || (U(null), De(null));
168
168
  };
169
169
  return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
170
- }, [$, V]), C(() => {
170
+ }, [J, I]), Y(() => {
171
171
  const e = window.setTimeout(
172
- () => He(Fe.trim()),
173
- or
172
+ () => Je(Pe.trim()),
173
+ vr
174
174
  );
175
175
  return () => window.clearTimeout(e);
176
- }, [Fe]), C(() => {
177
- if (V === null) return;
178
- const e = ee.find((r, s) => E(r, s) === V);
176
+ }, [Pe]), Y(() => {
177
+ if (I === null) return;
178
+ const e = re.find((r, s) => O(r, s) === I);
179
179
  if (!e || "children" in e || !e.filterRequest) return;
180
- const t = ++ke.current;
181
- Promise.resolve().then(() => e.filterRequest(re)).then(
180
+ const t = ++Oe.current;
181
+ Promise.resolve().then(() => e.filterRequest(ae)).then(
182
182
  (r) => {
183
- ke.current === t && De(r);
183
+ Oe.current === t && ke(r);
184
184
  },
185
185
  () => {
186
- ke.current === t && De([]);
186
+ Oe.current === t && ke([]);
187
187
  }
188
188
  );
189
- }, [re, ee, V]);
190
- const U = Z(() => {
191
- if (!i || i.serverPagination)
192
- return z.map((t, r) => ({ record: t, index: r })).filter(({ record: t, index: r }) => {
193
- if (!h || ie(t, r)) return !0;
194
- const s = L(t, r, _);
195
- return z.some(
196
- (d, c) => ie(d, c) && J.includes(be(d, c)) && Je(d, c).includes(s)
189
+ }, [ae, re, I]);
190
+ const V = X(() => {
191
+ if (!n || n.serverPagination)
192
+ return S.map((t, r) => ({ record: t, index: r })).filter(({ record: t, index: r }) => {
193
+ if (!h || ne(t, r)) return !0;
194
+ const s = q(t, r, g);
195
+ return S.some(
196
+ (l, a) => ne(l, a) && Q.includes(oe(l, a)) && rt(l, a).includes(s)
197
197
  );
198
198
  });
199
- const e = (H - 1) * q;
200
- return z.slice(e, e + q).map((t, r) => ({
199
+ const e = (H - 1) * W;
200
+ return S.slice(e, e + W).map((t, r) => ({
201
201
  record: t,
202
202
  index: e + r
203
203
  })).filter(({ record: t, index: r }) => {
204
- if (!h || ie(t, r)) return !0;
205
- const s = L(t, r, _);
206
- return z.some(
207
- (d, c) => ie(d, c) && J.includes(be(d, c)) && Je(d, c).includes(s)
204
+ if (!h || ne(t, r)) return !0;
205
+ const s = q(t, r, g);
206
+ return S.some(
207
+ (l, a) => ne(l, a) && Q.includes(oe(l, a)) && rt(l, a).includes(s)
208
208
  );
209
209
  });
210
- }, [H, J, h, q, i, z, _]), Qe = Z(
211
- () => U.map(({ record: e, index: t }) => L(e, t, _)),
212
- [_, U]
213
- ), Mt = K.map(String).join("|"), Tt = Qe.map(String).join("|");
214
- C(() => {
215
- var d;
216
- if (!l || F || K.length === 0) return;
217
- const e = new Set(Qe), t = K.filter((c) => e.has(c));
218
- if (t.length === K.length) return;
219
- l.selectedRowKeys === void 0 && Ge(t);
220
- const r = new Set(t), s = U.filter(({ record: c, index: a }) => r.has(L(c, a, _))).map(({ record: c }) => c);
221
- (d = l.onChange) == null || d.call(l, t, s, { type: "multiple" });
222
- }, [F, l, _, Mt, Tt, U]);
223
- const he = (e, t = P, r = B, s = H, d = q) => {
224
- const c = Object.fromEntries(r), a = dt(o, v, r), g = ct(a, v, t);
210
+ }, [H, Q, h, W, n, S, g]), it = X(
211
+ () => V.map(({ record: e, index: t }) => q(e, t, g)),
212
+ [g, V]
213
+ ), qt = B.map(String).join("|"), At = it.map(String).join("|");
214
+ Y(() => {
215
+ var l;
216
+ if (!d || D || B.length === 0) return;
217
+ const e = new Set(it), t = B.filter((a) => e.has(a));
218
+ if (t.length === B.length) return;
219
+ d.selectedRowKeys === void 0 && We(t);
220
+ const r = new Set(t), s = V.filter(({ record: a, index: i }) => r.has(q(a, i, g))).map(({ record: a }) => a);
221
+ (l = d.onChange) == null || l.call(d, t, s, { type: "multiple" });
222
+ }, [D, d, g, qt, At, V]), Y(() => {
223
+ const e = Re.current;
224
+ if (!e || !(f != null && f.x)) {
225
+ Ze((a) => a.start === 0 && a.end === 0 ? a : { start: 0, end: 0 }), Ye((a) => a.start || a.end ? { start: !1, end: !1 } : a);
226
+ return;
227
+ }
228
+ const t = () => {
229
+ const a = e.querySelector(".bj-table__header .bj-table__header-row") ?? e.querySelector(".bj-table__body .bj-table__row");
230
+ let i = 0, _ = 0;
231
+ if (a) {
232
+ Array.from(a.children).forEach((p) => {
233
+ const u = p.getBoundingClientRect().width;
234
+ p.classList.contains("bj-table__cell--fixed-right") ? _ += u : (p.classList.contains("bj-table__cell--fixed-left") || p.classList.contains("bj-table__selection-cell--fixed")) && (i += u);
235
+ });
236
+ const o = e.clientLeft;
237
+ i > 0 && (i += o), _ > 0 && (_ = Math.max(_ - o, 0));
238
+ }
239
+ Ze((o) => o.start === i && o.end === _ ? o : { start: i, end: _ });
240
+ }, r = () => {
241
+ const a = e.scrollWidth - e.clientWidth, i = a > Te, _ = {
242
+ start: i && e.scrollLeft > Te,
243
+ end: i && e.scrollLeft < a - Te
244
+ };
245
+ Ye((o) => o.start === _.start && o.end === _.end ? o : _);
246
+ }, s = () => {
247
+ t(), r();
248
+ };
249
+ s(), e.addEventListener("scroll", r, { passive: !0 });
250
+ const l = new ResizeObserver(s);
251
+ return l.observe(e), e.firstElementChild && l.observe(e.firstElementChild), () => {
252
+ e.removeEventListener("scroll", r), l.disconnect();
253
+ };
254
+ }, [wt, f == null ? void 0 : f.x, Ie, V.length]);
255
+ const _e = (e, t = P, r = K, s = H, l = W) => {
256
+ const a = Object.fromEntries(r), i = yt(j, y, r), _ = jt(i, y, t);
225
257
  pe == null || pe(
226
- { ...i, current: s, pageSize: d, total: (i == null ? void 0 : i.total) ?? g.length },
227
- c,
228
- cr(v, t),
229
- { action: e, currentDataSource: g }
258
+ { ...n, current: s, pageSize: l, total: (n == null ? void 0 : n.total) ?? _.length },
259
+ a,
260
+ jr(y, t),
261
+ { action: e, currentDataSource: _ }
230
262
  );
231
- }, It = (e, t) => {
263
+ }, Wt = (e, t) => {
232
264
  if (!e.sorter) return;
233
- const r = E(e, t), s = dr(P.get(r) ?? null, e.sortDirections ?? mt), d = /* @__PURE__ */ new Map();
234
- d.set(r, s), e.sortOrder === void 0 && Dt(d), he("sort", d);
235
- }, Re = (e, t, r) => {
236
- const s = E(e, t), d = new Map(B);
237
- d.set(s, r), e.filteredValue === void 0 && Pt(d), W(null), (i == null ? void 0 : i.current) === void 0 && ce(1), he("filter", P, d, 1);
238
- }, St = (e, t) => {
239
- const r = E(e, t), s = e.filterResetToDefaultFilteredValue ? e.defaultFilteredValue ?? [] : [];
240
- te((d) => new Map(d).set(r, s));
241
- }, oe = (e, t, r) => {
242
- var d, c, a, g;
243
- const s = E(e, t);
244
- if (V === s) {
245
- W(null), xe(null), (d = e.onFilterDropdownOpenChange) == null || d.call(e, !1), (c = e.onFilterDropdownVisibleChange) == null || c.call(e, !1);
265
+ const r = O(e, t), s = yr(P.get(r) ?? null, e.sortDirections ?? Dt), l = /* @__PURE__ */ new Map();
266
+ l.set(r, s), e.sortOrder === void 0 && Kt(l), _e("sort", l);
267
+ }, Ke = (e, t, r) => {
268
+ const s = O(e, t), l = new Map(K);
269
+ l.set(s, r), e.filteredValue === void 0 && zt(l), U(null), (n == null ? void 0 : n.current) === void 0 && be(1), _e("filter", P, l, 1);
270
+ }, $t = (e, t) => {
271
+ const r = O(e, t), s = e.filterResetToDefaultFilteredValue ? e.defaultFilteredValue ?? [] : [];
272
+ ie((l) => new Map(l).set(r, s));
273
+ }, ue = (e, t, r) => {
274
+ var l, a, i, _;
275
+ const s = O(e, t);
276
+ if (I === s) {
277
+ U(null), De(null), (l = e.onFilterDropdownOpenChange) == null || l.call(e, !1), (a = e.onFilterDropdownVisibleChange) == null || a.call(e, !1);
246
278
  return;
247
279
  }
248
- qe(""), He(""), De(void 0), te((j) => new Map(j).set(s, B.get(s) ?? [])), W(s), r && xe(r), (a = e.onFilterDropdownOpenChange) == null || a.call(e, !0), (g = e.onFilterDropdownVisibleChange) == null || g.call(e, !0);
249
- }, Vt = (e, t) => {
250
- var N, T;
251
- const r = E(e, t), s = `bj-table-badge-${Kt}-${String(r).replace(/[^a-zA-Z0-9_-]/g, "-")}`, d = P.get(r) ?? null, c = B.get(r) ?? [], a = Le.get(r) ?? c, g = e.filterDropdownOpen ?? e.filterDropdownVisible ?? V === r, j = e.filtered || c.length > 0, R = d === "ascend" ? "icon-a-zhengxumian" : d === "descend" ? "icon-a-daoxumian" : "icon-a-weipaixumian", y = ft(e.title, {
252
- sortOrder: d,
253
- sortColumn: d ? e : void 0,
254
- sortColumns: d ? [{ column: e, order: d }] : [],
255
- filters: Object.fromEntries(B)
256
- }), Q = typeof e.filterDropdown == "function" ? e.filterDropdown({
280
+ Ue(""), Je(""), ke(void 0), ie((o) => new Map(o).set(s, K.get(s) ?? [])), U(s), r && De(r), (i = e.onFilterDropdownOpenChange) == null || i.call(e, !0), (_ = e.onFilterDropdownVisibleChange) == null || _.call(e, !0);
281
+ }, Ht = (e, t) => {
282
+ var F, M;
283
+ const r = O(e, t), s = `bj-table-badge-${It}-${String(r).replace(/[^a-zA-Z0-9_-]/g, "-")}`, l = P.get(r) ?? null, a = K.get(r) ?? [], i = $e.get(r) ?? a, _ = e.filterDropdownOpen ?? e.filterDropdownVisible ?? I === r, o = e.filtered || a.length > 0, p = l === "ascend" ? "icon-a-zhengxumian" : l === "descend" ? "icon-a-daoxumian" : "icon-a-weipaixumian", u = mt(e.title, {
284
+ sortOrder: l,
285
+ sortColumn: l ? e : void 0,
286
+ sortColumns: l ? [{ column: e, order: l }] : [],
287
+ filters: Object.fromEntries(K)
288
+ }), Z = typeof e.filterDropdown == "function" ? e.filterDropdown({
257
289
  prefixCls: "bj-table",
258
- selectedKeys: a.filter((n) => typeof n != "boolean"),
259
- setSelectedKeys: (n) => te((m) => new Map(m).set(r, n)),
260
- confirm: (n) => {
261
- Re(e, t, Le.get(r) ?? a), (n == null ? void 0 : n.closeDropdown) === !1 && W(r);
290
+ selectedKeys: i.filter((c) => typeof c != "boolean"),
291
+ setSelectedKeys: (c) => ie((x) => new Map(x).set(r, c)),
292
+ confirm: (c) => {
293
+ Ke(e, t, $e.get(r) ?? i), (c == null ? void 0 : c.closeDropdown) === !1 && U(r);
262
294
  },
263
- clearFilters: (n) => {
264
- const m = e.filterResetToDefaultFilteredValue ? e.defaultFilteredValue ?? [] : [];
265
- te((O) => new Map(O).set(r, m)), (n == null ? void 0 : n.confirm) === !0 && Re(e, t, m), ((n == null ? void 0 : n.closeDropdown) === !1 || (n == null ? void 0 : n.confirm) !== !0) && W(r);
295
+ clearFilters: (c) => {
296
+ const x = e.filterResetToDefaultFilteredValue ? e.defaultFilteredValue ?? [] : [];
297
+ ie((k) => new Map(k).set(r, x)), (c == null ? void 0 : c.confirm) === !0 && Ke(e, t, x), ((c == null ? void 0 : c.closeDropdown) === !1 || (c == null ? void 0 : c.confirm) !== !0) && U(r);
266
298
  },
267
299
  filters: e.filters,
268
- close: () => W(null),
269
- visible: g
270
- }) : e.filterDropdown, G = e.filterRequest ? Bt ?? [] : e.filters ?? [], I = re && !e.filterRequest ? G.filter((n) => typeof e.filterSearch == "function" ? e.filterSearch(re, n) : jr(re, n)) : G, p = !!(e.filterSearch || e.filterRequest), M = /* @__PURE__ */ k("div", { className: S("bj-table__column-header", e.sorter && "bj-table__column-header--sortable"), children: [
271
- e.badge !== void 0 && /* @__PURE__ */ f(
300
+ close: () => U(null),
301
+ visible: _
302
+ }) : e.filterDropdown, G = e.filterRequest ? Vt ?? [] : e.filters ?? [], T = ae && !e.filterRequest ? G.filter((c) => typeof e.filterSearch == "function" ? e.filterSearch(ae, c) : Fr(ae, c)) : G, v = !!(e.filterSearch || e.filterRequest), z = /* @__PURE__ */ E("div", { className: L("bj-table__column-header", e.sorter && "bj-table__column-header--sortable"), children: [
303
+ e.badge !== void 0 && /* @__PURE__ */ b(
272
304
  "span",
273
305
  {
274
306
  "aria-label": "表头提示",
275
307
  className: "bj-table__column-badge-trigger",
276
308
  id: s,
277
- onBlur: () => fe(null),
278
- onClick: (n) => n.stopPropagation(),
279
- onFocus: () => fe(r),
280
- onKeyDown: (n) => n.stopPropagation(),
281
- onMouseEnter: () => fe(r),
282
- onMouseLeave: () => fe(null),
309
+ onBlur: () => he(null),
310
+ onClick: (c) => c.stopPropagation(),
311
+ onFocus: () => he(r),
312
+ onKeyDown: (c) => c.stopPropagation(),
313
+ onMouseEnter: () => he(r),
314
+ onMouseLeave: () => he(null),
283
315
  role: "button",
284
316
  tabIndex: 0,
285
- children: /* @__PURE__ */ f("span", { "aria-hidden": "true", className: "bj-table__column-badge-shape" })
317
+ children: /* @__PURE__ */ b("span", { "aria-hidden": "true", className: "bj-table__column-badge-shape" })
286
318
  }
287
319
  ),
288
- /* @__PURE__ */ k("div", { className: "bj-table__column-title", children: [
289
- /* @__PURE__ */ f("span", { className: "bj-table__column-title-content", children: y }),
290
- e.sorter && /* @__PURE__ */ f("span", { "aria-hidden": "true", className: "bj-table__column-sorter", children: /* @__PURE__ */ f(Be, { className: "bj-table__column-sorter-icon", type: R }) })
320
+ /* @__PURE__ */ E("div", { className: "bj-table__column-title", children: [
321
+ /* @__PURE__ */ b("span", { className: "bj-table__column-title-content", children: u }),
322
+ e.sorter && /* @__PURE__ */ b("span", { "aria-hidden": "true", className: "bj-table__column-sorter", children: /* @__PURE__ */ b(Le, { className: "bj-table__column-sorter-icon", type: p }) })
291
323
  ] }),
292
- (e.filters || e.filterDropdown) && /* @__PURE__ */ k("div", { className: "bj-table__filter", children: [
293
- /* @__PURE__ */ f(
324
+ (e.filters || e.filterDropdown) && /* @__PURE__ */ E("div", { className: "bj-table__filter", children: [
325
+ /* @__PURE__ */ b(
294
326
  "button",
295
327
  {
296
- "aria-expanded": g,
328
+ "aria-expanded": _,
297
329
  "aria-label": "筛选",
298
- className: S("bj-table__filter-trigger", j && "bj-table__filter-trigger--active"),
299
- onClick: (n) => {
300
- n.stopPropagation(), oe(e, t);
330
+ className: L("bj-table__filter-trigger", o && "bj-table__filter-trigger--active"),
331
+ onClick: (c) => {
332
+ c.stopPropagation(), ue(e, t);
301
333
  },
302
334
  type: "button",
303
- children: typeof e.filterIcon == "function" ? e.filterIcon(j) : e.filterIcon ?? /* @__PURE__ */ f(Be, { className: "bj-table__filter-icon", type: "icon-a-shaixuanxi" })
335
+ children: typeof e.filterIcon == "function" ? e.filterIcon(o) : e.filterIcon ?? /* @__PURE__ */ b(Le, { className: "bj-table__filter-icon", type: "icon-a-shaixuanxi" })
304
336
  }
305
337
  ),
306
- g && Ne && typeof document < "u" && Xt(
307
- /* @__PURE__ */ f(
338
+ _ && Ee && typeof document < "u" && nr(
339
+ /* @__PURE__ */ b(
308
340
  "div",
309
341
  {
310
342
  className: "bj-table__filter-dropdown",
311
- onClick: (n) => n.stopPropagation(),
343
+ onClick: (c) => c.stopPropagation(),
312
344
  role: "dialog",
313
- style: { left: Ne.left, top: Ne.top },
314
- children: Q ?? /* @__PURE__ */ f(
315
- rr,
345
+ style: { left: Ee.left, top: Ee.top },
346
+ children: Z ?? /* @__PURE__ */ b(
347
+ cr,
316
348
  {
317
349
  ...e.filterDropdownProps,
318
- emptyText: (Y == null ? void 0 : Y.filterEmptyText) ?? X("暂无结果"),
350
+ emptyText: (ee == null ? void 0 : ee.filterEmptyText) ?? C("暂无结果"),
319
351
  multiple: e.filterMultiple !== !1,
320
- onChange: (n, m) => {
321
- var O, lt;
322
- te((Qt) => new Map(Qt).set(r, n)), (lt = (O = e.filterDropdownProps) == null ? void 0 : O.onChange) == null || lt.call(O, n, m);
352
+ onChange: (c, x) => {
353
+ var k, ut;
354
+ ie((ir) => new Map(ir).set(r, c)), (ut = (k = e.filterDropdownProps) == null ? void 0 : k.onChange) == null || ut.call(k, c, x);
323
355
  },
324
- onConfirm: (n) => {
325
- var m, O;
326
- Re(e, t, n), (O = (m = e.filterDropdownProps) == null ? void 0 : m.onConfirm) == null || O.call(m, n);
356
+ onConfirm: (c) => {
357
+ var x, k;
358
+ Ke(e, t, c), (k = (x = e.filterDropdownProps) == null ? void 0 : x.onConfirm) == null || k.call(x, c);
327
359
  },
328
360
  onReset: () => {
329
- var n, m;
330
- St(e, t), (m = (n = e.filterDropdownProps) == null ? void 0 : n.onReset) == null || m.call(n);
361
+ var c, x;
362
+ $t(e, t), (x = (c = e.filterDropdownProps) == null ? void 0 : c.onReset) == null || x.call(c);
331
363
  },
332
- onSearch: (n) => {
333
- var m, O;
334
- qe(n), (O = (m = e.filterDropdownProps) == null ? void 0 : m.onSearch) == null || O.call(m, n);
364
+ onSearch: (c) => {
365
+ var x, k;
366
+ Ue(c), (k = (x = e.filterDropdownProps) == null ? void 0 : x.onSearch) == null || k.call(x, c);
335
367
  },
336
- options: I.map((n) => ({
337
- label: n.text,
338
- description: n.description,
339
- value: n.value
368
+ options: T.map((c) => ({
369
+ label: c.text,
370
+ description: c.description,
371
+ value: c.value
340
372
  })),
341
- searchable: ((N = e.filterDropdownProps) == null ? void 0 : N.searchable) ?? p,
342
- searchPlaceholder: ((T = e.filterDropdownProps) == null ? void 0 : T.searchPlaceholder) ?? (e.filterRequest ? X("请输入搜索内容") : (Y == null ? void 0 : Y.filterSearchPlaceholder) ?? X("搜索")),
343
- searchValue: Fe,
344
- t: X,
345
- value: a
373
+ searchable: ((F = e.filterDropdownProps) == null ? void 0 : F.searchable) ?? v,
374
+ searchPlaceholder: ((M = e.filterDropdownProps) == null ? void 0 : M.searchPlaceholder) ?? (e.filterRequest ? C("请输入搜索内容") : (ee == null ? void 0 : ee.filterSearchPlaceholder) ?? C("搜索")),
375
+ searchValue: Pe,
376
+ t: C,
377
+ value: i
346
378
  }
347
379
  )
348
380
  }
@@ -351,14 +383,14 @@ function pr({
351
383
  )
352
384
  ] })
353
385
  ] });
354
- return e.badge !== void 0 ? /* @__PURE__ */ k(
355
- er,
386
+ return e.badge !== void 0 ? /* @__PURE__ */ E(
387
+ dr,
356
388
  {
357
389
  className: "bj-table__column-tooltip-wrapper",
358
390
  children: [
359
- /* @__PURE__ */ f("div", { className: "bj-table__column-tooltip-trigger", children: M }),
360
- Et === r && /* @__PURE__ */ f(
361
- Ct,
391
+ /* @__PURE__ */ b("div", { className: "bj-table__column-tooltip-trigger", children: z }),
392
+ Lt === r && /* @__PURE__ */ b(
393
+ lr,
362
394
  {
363
395
  className: "bj-table__column-tooltip",
364
396
  content: e.badge,
@@ -369,280 +401,298 @@ function pr({
369
401
  )
370
402
  ]
371
403
  }
372
- ) : M;
373
- }, Ze = (e, t, r) => {
374
- var c, a;
375
- t.selectedRowKeys === void 0 && Ge(e);
376
- const s = new Set(e), d = o.filter(
377
- (g, j) => s.has(L(g, j, _))
404
+ ) : z;
405
+ }, at = (e, t, r) => {
406
+ var a, i;
407
+ t.selectedRowKeys === void 0 && We(e);
408
+ const s = new Set(e), l = j.filter(
409
+ (_, o) => s.has(q(_, o, g))
378
410
  );
379
- (c = t.onChange) == null || c.call(t, e, d), r && ((a = t.onSelect) == null || a.call(
411
+ (a = t.onChange) == null || a.call(t, e, l), r && ((i = t.onSelect) == null || i.call(
380
412
  t,
381
413
  r,
382
- s.has(L(r, o.indexOf(r), _)),
383
- d
414
+ s.has(q(r, j.indexOf(r), g)),
415
+ l
384
416
  ));
385
- }, wt = (e, t) => {
386
- if (!l)
417
+ }, Ut = (e, t) => {
418
+ if (!d)
387
419
  return;
388
- const r = L(e, t, _), s = K.includes(r), d = l.type === "radio" ? s ? [] : [r] : s ? K.filter((c) => c !== r) : [...K, r];
389
- Ze(d, l, e);
390
- }, Xe = U.filter(
420
+ const r = q(e, t, g), s = B.includes(r), l = d.type === "radio" ? s ? [] : [r] : s ? B.filter((a) => a !== r) : [...B, r];
421
+ at(l, d, e);
422
+ }, nt = V.filter(
391
423
  ({ record: e }) => {
392
424
  var t;
393
- return !((t = l == null ? void 0 : l.getCheckboxProps) != null && t.call(l, e).disabled);
425
+ return !((t = d == null ? void 0 : d.getCheckboxProps) != null && t.call(d, e).disabled);
394
426
  }
395
- ), ae = Xe.map(
396
- ({ record: e, index: t }) => L(e, t, _)
397
- ), Oe = ae.length > 0 && ae.every((e) => K.includes(e)), Gt = () => {
427
+ ), se = nt.map(
428
+ ({ record: e, index: t }) => q(e, t, g)
429
+ ), Se = se.length > 0 && se.every((e) => B.includes(e)), Jt = () => {
398
430
  var r;
399
- if (!l || l.type === "radio")
431
+ if (!d || d.type === "radio")
400
432
  return;
401
- const e = new Set(ae), t = Oe ? K.filter((s) => !e.has(s)) : Array.from(/* @__PURE__ */ new Set([...K, ...ae]));
402
- Ze(t, l), new Set(t), (r = l.onSelectAll) == null || r.call(
403
- l,
404
- !Oe,
405
- Xe.map(({ record: s }) => s)
433
+ const e = new Set(se), t = Se ? B.filter((s) => !e.has(s)) : Array.from(/* @__PURE__ */ new Set([...B, ...se]));
434
+ at(t, d), new Set(t), (r = d.onSelectAll) == null || r.call(
435
+ d,
436
+ !Se,
437
+ nt.map(({ record: s }) => s)
406
438
  );
407
- }, Lt = (e) => {
439
+ }, Qt = (e) => {
408
440
  var t;
409
- !i || e < 1 || e > $e || e === H || (i.current === void 0 && ce(e), (t = i.onChange) == null || t.call(i, e, q), he("paginate", P, B, e));
410
- }, At = (e) => {
441
+ !n || e < 1 || e > tt || e === H || (n.current === void 0 && be(e), (t = n.onChange) == null || t.call(n, e, W), _e("paginate", P, K, e));
442
+ }, Zt = (e) => {
411
443
  var r, s;
412
- if (!i || e === q)
444
+ if (!n || e === W)
413
445
  return;
414
446
  const t = 1;
415
- Pe.current = !0, i.pageSize === void 0 && Nt(e), i.current === void 0 && ce(t), (r = i.onShowSizeChange) == null || r.call(i, t, e), (s = i.onChange) == null || s.call(i, t, e), he("paginate", P, B, t, e);
416
- }, Ye = v.length + (l ? 1 : 0), se = (l == null ? void 0 : l.columnWidth) ?? 48, Ce = (e) => typeof e.width == "number" ? e.width : 0, et = (e, t) => {
447
+ Be.current = !0, n.pageSize === void 0 && Ot(e), n.current === void 0 && be(t), (r = n.onShowSizeChange) == null || r.call(n, t, e), (s = n.onChange) == null || s.call(n, t, e), _e("paginate", P, K, t, e);
448
+ }, st = y.length + (d ? 1 : 0), le = (d == null ? void 0 : d.columnWidth) ?? 48, lt = (e) => typeof e.width == "number" ? e.width : 0, dt = (e, t) => {
417
449
  const r = e.fixed === !0 ? "left" : e.fixed;
418
- return r === "left" ? { position: "sticky", left: v.slice(0, t).reduce((d, c) => d + Ce(c), l && typeof se == "number" ? se : 0), zIndex: 2 } : r === "right" ? { position: "sticky", right: v.slice(t + 1).reduce((d, c) => d + Ce(c), 0), zIndex: 2 } : {};
419
- }, qt = b != null && b.x ? {
420
- width: b.x === !0 ? "max-content" : b.x,
450
+ return r === "left" ? { position: "sticky", left: y.slice(0, t).reduce((l, a) => l + lt(a), d && typeof le == "number" ? le : 0), zIndex: 2 } : r === "right" ? { position: "sticky", right: y.slice(t + 1).reduce((l, a) => l + lt(a), 0), zIndex: 2 } : {};
451
+ }, Xt = f != null && f.x ? {
452
+ width: f.x === !0 ? "max-content" : f.x,
421
453
  minWidth: "100%",
422
- tableLayout: Se ?? "fixed"
423
- } : { tableLayout: Se }, Ht = (x == null ? void 0 : x.table) ?? "table", Ut = ((at = x == null ? void 0 : x.header) == null ? void 0 : at.wrapper) ?? "thead", Wt = ((st = x == null ? void 0 : x.header) == null ? void 0 : st.row) ?? "tr", tt = ((nt = x == null ? void 0 : x.header) == null ? void 0 : nt.cell) ?? "th", w = typeof (x == null ? void 0 : x.body) == "object" ? x.body : void 0, $t = (w == null ? void 0 : w.wrapper) ?? "tbody", rt = (w == null ? void 0 : w.row) ?? "tr", Ee = (w == null ? void 0 : w.cell) ?? "td", Jt = typeof _e == "function" ? _e() : _e ?? X("暂无数据"), it = typeof ye == "string" ? /* @__PURE__ */ f("img", { alt: "", className: "bj-table__empty-image", src: ye }) : ye;
424
- return /* @__PURE__ */ k(
454
+ tableLayout: ve ?? "fixed"
455
+ } : { tableLayout: ve }, Yt = (N == null ? void 0 : N.table) ?? "table", Ct = ((ht = N == null ? void 0 : N.header) == null ? void 0 : ht.wrapper) ?? "thead", er = ((ot = N == null ? void 0 : N.header) == null ? void 0 : ot.row) ?? "tr", ft = ((_t = N == null ? void 0 : N.header) == null ? void 0 : _t.cell) ?? "th", w = typeof (N == null ? void 0 : N.body) == "object" ? N.body : void 0, tr = (w == null ? void 0 : w.wrapper) ?? "tbody", ct = (w == null ? void 0 : w.row) ?? "tr", ze = (w == null ? void 0 : w.cell) ?? "td", rr = typeof je == "function" ? je() : je ?? C("暂无数据"), bt = typeof me == "string" ? /* @__PURE__ */ b("img", { alt: "", className: "bj-table__empty-image", src: me }) : me;
456
+ return /* @__PURE__ */ E(
425
457
  "div",
426
458
  {
427
- id: vt,
428
- ref: le,
429
- className: S(
459
+ id: Et,
460
+ ref: fe,
461
+ className: L(
430
462
  "bj-table",
431
- ot && "bj-table--bordered",
432
- `bj-table--${ut}`,
433
- ue && "bj-table--loading",
434
- z.length === 0 && "bj-table--empty",
435
- jt
463
+ vt && "bj-table--bordered",
464
+ `bj-table--${xt}`,
465
+ ye && "bj-table--loading",
466
+ S.length === 0 && "bj-table--empty",
467
+ Xe.start && "bj-table--ping-left",
468
+ Xe.end && "bj-table--ping-right",
469
+ Rt
436
470
  ),
437
- style: pt,
471
+ style: Ft,
438
472
  children: [
439
- Me && /* @__PURE__ */ f("div", { className: "bj-table__title", children: Me(z) }),
440
- /* @__PURE__ */ k("div", { className: "bj-table__viewport", children: [
441
- /* @__PURE__ */ f(
473
+ we && /* @__PURE__ */ b("div", { className: "bj-table__title", children: we(S) }),
474
+ /* @__PURE__ */ E("div", { className: "bj-table__viewport", children: [
475
+ /* @__PURE__ */ b(
442
476
  "div",
443
477
  {
444
- className: S("bj-table__scroll", !!(b != null && b.x || b != null && b.y) && "bj-overlay-scrollbar-hidden"),
445
- ref: Ve,
446
- style: { maxHeight: b == null ? void 0 : b.y },
447
- children: /* @__PURE__ */ k(Ht, { className: "bj-table__native-table", style: qt, children: [
448
- v.some((e) => e.width) && /* @__PURE__ */ k("colgroup", { children: [
449
- l && /* @__PURE__ */ f("col", { className: "bj-table__selection-col", style: { width: se } }),
450
- v.map((e, t) => /* @__PURE__ */ f("col", { style: { width: e.width } }, e.key ?? t))
478
+ className: L("bj-table__scroll", !!(f != null && f.x || f != null && f.y) && "bj-overlay-scrollbar-hidden"),
479
+ ref: Re,
480
+ style: { maxHeight: f == null ? void 0 : f.y },
481
+ children: /* @__PURE__ */ E(Yt, { className: "bj-table__native-table", style: Xt, children: [
482
+ y.some((e) => e.width) && /* @__PURE__ */ E("colgroup", { children: [
483
+ d && /* @__PURE__ */ b("col", { className: "bj-table__selection-col", style: { width: le } }),
484
+ y.map((e, t) => /* @__PURE__ */ b("col", { style: { width: e.width } }, e.key ?? t))
451
485
  ] }),
452
- _t && /* @__PURE__ */ f(Ut, { className: "bj-table__header", children: we.map((e, t) => /* @__PURE__ */ k(Wt, { className: "bj-table__header-row", ...ve == null ? void 0 : ve(v, t), children: [
453
- l && t === 0 && /* @__PURE__ */ k(
454
- tt,
486
+ Ie && /* @__PURE__ */ b(Ct, { className: "bj-table__header", children: Ae.map((e, t) => /* @__PURE__ */ E(er, { className: "bj-table__header-row", ...Ne == null ? void 0 : Ne(y, t), children: [
487
+ d && t === 0 && /* @__PURE__ */ E(
488
+ ft,
455
489
  {
456
- className: S("bj-table__header-cell", "bj-table__selection-cell", !!(b != null && b.x) && "bj-table__selection-cell--fixed"),
457
- rowSpan: we.length,
490
+ className: L(
491
+ "bj-table__header-cell",
492
+ "bj-table__selection-cell",
493
+ !!(f != null && f.x) && "bj-table__selection-cell--fixed",
494
+ // 选择列就是最后一个左固定区域时,由它承担左侧渐变阴影
495
+ !!(f != null && f.x) && !$(y[0]) && "bj-table__cell--fixed-left-last"
496
+ ),
497
+ rowSpan: Ae.length,
458
498
  scope: "col",
459
- style: { width: se },
499
+ style: { width: le },
460
500
  children: [
461
- l.type !== "radio" && /* @__PURE__ */ f(
462
- bt,
501
+ d.type !== "radio" && /* @__PURE__ */ b(
502
+ gt,
463
503
  {
464
- checked: Oe,
465
- disabled: ae.length === 0,
466
- onChange: Gt,
504
+ checked: Se,
505
+ disabled: se.length === 0,
506
+ onChange: Jt,
467
507
  label: "选择当前页所有行"
468
508
  }
469
509
  ),
470
- l.columnTitle
510
+ d.columnTitle
471
511
  ]
472
512
  }
473
513
  ),
474
- e.map(({ column: r, colSpan: s, rowSpan: d }, c) => {
475
- var G, I;
476
- const a = r, g = v.indexOf(a), j = g >= 0 ? g : c, R = !("children" in r) && !!(a.filters || a.filterDropdown), y = !("children" in r) && !!a.sorter, Q = () => {
477
- R ? oe(a, j) : y && It(a, j);
514
+ e.map(({ column: r, colSpan: s, rowSpan: l }, a) => {
515
+ var G, T;
516
+ const i = r, _ = y.indexOf(i), o = _ >= 0 ? _ : a, p = !("children" in r) && !!(i.filters || i.filterDropdown), u = !("children" in r) && !!i.sorter, Z = () => {
517
+ p ? ue(i, o) : u && Wt(i, o);
478
518
  };
479
- return /* @__PURE__ */ Ke(
480
- tt,
519
+ return /* @__PURE__ */ Me(
520
+ ft,
481
521
  {
482
- ...(G = a.onHeaderCell) == null ? void 0 : G.call(a, r, c),
483
- "aria-label": typeof a.title == "string" ? a.title : void 0,
484
- "aria-sort": y ? P.get(E(a, j)) === "ascend" ? "ascending" : P.get(E(a, j)) === "descend" ? "descending" : "none" : void 0,
485
- className: S(
522
+ ...(G = i.onHeaderCell) == null ? void 0 : G.call(i, r, a),
523
+ "aria-label": typeof i.title == "string" ? i.title : void 0,
524
+ "aria-sort": u ? P.get(O(i, o)) === "ascend" ? "ascending" : P.get(O(i, o)) === "descend" ? "descending" : "none" : void 0,
525
+ className: L(
486
526
  "bj-table__header-cell",
487
- ((I = v[j + 1]) == null ? void 0 : I.fixed) === "right" && "bj-table__cell--before-fixed-right",
488
- a.fixed && "bj-table__cell--fixed",
489
- (a.fixed === "left" || a.fixed === !0) && "bj-table__cell--fixed-left",
490
- a.fixed === "right" && "bj-table__cell--fixed-right",
491
- a.sorter && "bj-table__header-cell--sortable",
492
- R && "bj-table__header-cell--filterable",
493
- P.get(E(a, j)) && "bj-table__header-cell--sorted",
494
- a.className
527
+ ((T = y[o + 1]) == null ? void 0 : T.fixed) === "right" && "bj-table__cell--before-fixed-right",
528
+ i.fixed && "bj-table__cell--fixed",
529
+ $(i) && "bj-table__cell--fixed-left",
530
+ $(i) && !$(y[o + 1]) && "bj-table__cell--fixed-left-last",
531
+ te(i) && "bj-table__cell--fixed-right",
532
+ te(i) && !te(y[o - 1]) && "bj-table__cell--fixed-right-first",
533
+ i.sorter && "bj-table__header-cell--sortable",
534
+ p && "bj-table__header-cell--filterable",
535
+ P.get(O(i, o)) && "bj-table__header-cell--sorted",
536
+ i.className
495
537
  ),
496
538
  colSpan: s,
497
- key: a.key ?? String(a.dataIndex ?? c),
498
- onClick: (p) => {
499
- var M, N, T;
500
- (T = (N = (M = a.onHeaderCell) == null ? void 0 : M.call(a, r, c)) == null ? void 0 : N.onClick) == null || T.call(N, p), !p.target.closest(".bj-table__filter-dropdown") && (R ? oe(a, j, p.currentTarget) : Q());
539
+ key: i.key ?? String(i.dataIndex ?? a),
540
+ onClick: (v) => {
541
+ var z, F, M;
542
+ (M = (F = (z = i.onHeaderCell) == null ? void 0 : z.call(i, r, a)) == null ? void 0 : F.onClick) == null || M.call(F, v), !v.target.closest(".bj-table__filter-dropdown") && (p ? ue(i, o, v.currentTarget) : Z());
501
543
  },
502
- onKeyDown: (p) => {
503
- var M, N, T;
504
- (T = (N = (M = a.onHeaderCell) == null ? void 0 : M.call(a, r, c)) == null ? void 0 : N.onKeyDown) == null || T.call(N, p), !p.target.closest(".bj-table__filter-dropdown") && (p.key === "Enter" || p.key === " ") && (p.preventDefault(), R ? oe(a, j, p.currentTarget) : Q());
544
+ onKeyDown: (v) => {
545
+ var z, F, M;
546
+ (M = (F = (z = i.onHeaderCell) == null ? void 0 : z.call(i, r, a)) == null ? void 0 : F.onKeyDown) == null || M.call(F, v), !v.target.closest(".bj-table__filter-dropdown") && (v.key === "Enter" || v.key === " ") && (v.preventDefault(), p ? ue(i, o, v.currentTarget) : Z());
505
547
  },
506
- rowSpan: d,
548
+ rowSpan: l,
507
549
  scope: "col",
508
- style: { textAlign: a.align, ...et(a, j) },
509
- tabIndex: R || y ? 0 : void 0
550
+ style: { textAlign: i.align, ...dt(i, o) },
551
+ tabIndex: p || u ? 0 : void 0
510
552
  },
511
- "children" in r ? ft(r.title, { filters: Object.fromEntries(B) }) : Vt(a, j)
553
+ "children" in r ? mt(r.title, { filters: Object.fromEntries(K) }) : Ht(i, o)
512
554
  );
513
555
  })
514
556
  ] }, t)) }),
515
- /* @__PURE__ */ f($t, { className: "bj-table__body", children: U.length > 0 ? U.map(({ record: e, index: t }) => {
516
- var g;
517
- const r = L(e, t, _), s = ie(e, t), d = ((g = l == null ? void 0 : l.getCheckboxProps) == null ? void 0 : g.call(l, e).disabled) ?? !1, c = K.includes(r), a = typeof je == "function" ? je(e, t, 0) : je;
518
- return /* @__PURE__ */ Ke(
519
- rt,
557
+ /* @__PURE__ */ b(tr, { className: "bj-table__body", children: V.length > 0 ? V.map(({ record: e, index: t }) => {
558
+ var _;
559
+ const r = q(e, t, g), s = ne(e, t), l = ((_ = d == null ? void 0 : d.getCheckboxProps) == null ? void 0 : _.call(d, e).disabled) ?? !1, a = B.includes(r), i = typeof ge == "function" ? ge(e, t, 0) : ge;
560
+ return /* @__PURE__ */ Me(
561
+ ct,
520
562
  {
521
- ...me == null ? void 0 : me(e, t),
522
- className: S("bj-table__row", s && "bj-table__row--group", c && "bj-table__row--selected", a),
563
+ ...xe == null ? void 0 : xe(e, t),
564
+ className: L("bj-table__row", s && "bj-table__row--group", a && "bj-table__row--selected", i),
523
565
  key: r
524
566
  },
525
- l && !s && /* @__PURE__ */ f(
526
- Ee,
567
+ d && !s && /* @__PURE__ */ b(
568
+ ze,
527
569
  {
528
- className: S("bj-table__cell", "bj-table__selection-cell", !!(b != null && b.x) && "bj-table__selection-cell--fixed"),
529
- style: { width: se },
530
- children: /* @__PURE__ */ f(
531
- bt,
570
+ className: L(
571
+ "bj-table__cell",
572
+ "bj-table__selection-cell",
573
+ !!(f != null && f.x) && "bj-table__selection-cell--fixed",
574
+ // 选择列就是最后一个左固定区域时,由它承担左侧渐变阴影
575
+ !!(f != null && f.x) && !$(y[0]) && "bj-table__cell--fixed-left-last"
576
+ ),
577
+ style: { width: le },
578
+ children: /* @__PURE__ */ b(
579
+ gt,
532
580
  {
533
- checked: c,
534
- disabled: d,
581
+ checked: a,
582
+ disabled: l,
535
583
  label: `选择第 ${t + 1} 行`,
536
- name: l.type === "radio" ? "bj-table-row-selection" : void 0,
537
- onChange: () => wt(e, t),
538
- type: l.type ?? "checkbox"
584
+ name: d.type === "radio" ? "bj-table-row-selection" : void 0,
585
+ onChange: () => Ut(e, t),
586
+ type: d.type ?? "checkbox"
539
587
  }
540
588
  )
541
589
  }
542
590
  ),
543
- v.map((j, R) => {
544
- var N, T, n;
545
- if (s && R > 0) return null;
546
- const y = j, Q = ur(e, y.dataIndex), G = y.render ? y.render(Q, e, t) : Q, I = yr(G) ? G : void 0, p = { ...(N = y.onCell) == null ? void 0 : N.call(y, e, t), ...I == null ? void 0 : I.props }, M = I ? I.children : G;
547
- return p.colSpan === 0 || p.rowSpan === 0 ? null : /* @__PURE__ */ Ke(
548
- Ee,
591
+ y.map((o, p) => {
592
+ var F, M, c;
593
+ if (s && p > 0) return null;
594
+ const u = o, Z = xr(e, u.dataIndex), G = u.render ? u.render(Z, e, t) : Z, T = Rr(G) ? G : void 0, v = { ...(F = u.onCell) == null ? void 0 : F.call(u, e, t), ...T == null ? void 0 : T.props }, z = T ? T.children : G;
595
+ return v.colSpan === 0 || v.rowSpan === 0 ? null : /* @__PURE__ */ Me(
596
+ ze,
549
597
  {
550
- ...p,
551
- className: S(
598
+ ...v,
599
+ className: L(
552
600
  "bj-table__cell",
553
- ((T = v[R + 1]) == null ? void 0 : T.fixed) === "right" && "bj-table__cell--before-fixed-right",
601
+ ((M = y[p + 1]) == null ? void 0 : M.fixed) === "right" && "bj-table__cell--before-fixed-right",
554
602
  s && "bj-table__cell--group",
555
- y.fixed && "bj-table__cell--fixed",
556
- (y.fixed === "left" || y.fixed === !0) && "bj-table__cell--fixed-left",
557
- y.fixed === "right" && "bj-table__cell--fixed-right",
558
- y.ellipsis && "bj-table__cell--ellipsis",
559
- y.className,
560
- p.className
603
+ u.fixed && "bj-table__cell--fixed",
604
+ $(u) && "bj-table__cell--fixed-left",
605
+ $(u) && !$(y[p + 1]) && "bj-table__cell--fixed-left-last",
606
+ te(u) && "bj-table__cell--fixed-right",
607
+ te(u) && !te(y[p - 1]) && "bj-table__cell--fixed-right-first",
608
+ u.ellipsis && "bj-table__cell--ellipsis",
609
+ u.className,
610
+ v.className
561
611
  ),
562
- key: y.key ?? String(y.dataIndex ?? R),
563
- colSpan: s ? Ye : p.colSpan,
564
- style: { textAlign: y.align, ...et(y, R), ...p.style }
612
+ key: u.key ?? String(u.dataIndex ?? p),
613
+ colSpan: s ? st : v.colSpan,
614
+ style: { textAlign: u.align, ...dt(u, p), ...v.style }
565
615
  },
566
- s ? ((n = h == null ? void 0 : h.render) == null ? void 0 : n.call(h, {
616
+ s ? ((c = h == null ? void 0 : h.render) == null ? void 0 : c.call(h, {
567
617
  record: e,
568
- expanded: J.includes(be(e, t)),
569
- onToggle: () => zt(e, t)
570
- })) ?? M ?? "" : /* @__PURE__ */ f("div", { className: "bj-table__cell-content", children: M ?? "" })
618
+ expanded: Q.includes(oe(e, t)),
619
+ onToggle: () => Gt(e, t)
620
+ })) ?? z ?? "" : /* @__PURE__ */ b("div", { className: "bj-table__cell-content", children: z ?? "" })
571
621
  );
572
622
  })
573
623
  );
574
- }) : /* @__PURE__ */ f(rt, { className: "bj-table__empty-row", children: /* @__PURE__ */ f(
575
- Ee,
624
+ }) : /* @__PURE__ */ b(ct, { className: "bj-table__empty-row", children: /* @__PURE__ */ b(
625
+ ze,
576
626
  {
577
627
  className: "bj-table__empty-cell",
578
- colSpan: Math.max(Ye, 1),
579
- style: { height: yt }
628
+ colSpan: Math.max(st, 1),
629
+ style: { height: Nt }
580
630
  }
581
631
  ) }) }),
582
- Ie && /* @__PURE__ */ f("tfoot", { className: "bj-table__summary", children: Ie(z) })
632
+ qe && /* @__PURE__ */ b("tfoot", { className: "bj-table__summary", children: qe(S) })
583
633
  ] })
584
634
  }
585
635
  ),
586
- U.length === 0 && /* @__PURE__ */ f("div", { className: "bj-table__empty-overlay", children: /* @__PURE__ */ k("div", { className: "bj-table__empty-content", children: [
587
- it && /* @__PURE__ */ f("div", { className: "bj-table__empty-image-wrap", children: it }),
588
- /* @__PURE__ */ f("div", { className: "bj-table__empty-text", children: Jt })
636
+ V.length === 0 && /* @__PURE__ */ b("div", { className: "bj-table__empty-overlay", children: /* @__PURE__ */ E("div", { className: "bj-table__empty-content", children: [
637
+ bt && /* @__PURE__ */ b("div", { className: "bj-table__empty-image-wrap", children: bt }),
638
+ /* @__PURE__ */ b("div", { className: "bj-table__empty-text", children: rr })
589
639
  ] }) })
590
640
  ] }),
591
- ((b == null ? void 0 : b.x) || (b == null ? void 0 : b.y)) && /* @__PURE__ */ f(
592
- ir,
641
+ ((f == null ? void 0 : f.x) || (f == null ? void 0 : f.y)) && /* @__PURE__ */ b(
642
+ br,
593
643
  {
594
- containerRef: le,
595
- direction: b != null && b.x && (b != null && b.y) ? "both" : b != null && b.x ? "horizontal" : "vertical",
644
+ containerRef: fe,
645
+ direction: f != null && f.x && (f != null && f.y) ? "both" : f != null && f.x ? "horizontal" : "vertical",
596
646
  gap: 2,
597
- horizontalInsetEnd: 0,
598
- horizontalInsetStart: 0,
647
+ horizontalInsetEnd: Qe.end,
648
+ horizontalInsetStart: Qe.start,
599
649
  size: 4,
600
- targetRef: Ve
650
+ targetRef: Re
601
651
  }
602
652
  ),
603
- Te && /* @__PURE__ */ f("div", { className: "bj-table__footer", children: Te(z) }),
604
- ue && /* @__PURE__ */ k("div", { "aria-live": "polite", "aria-busy": "true", className: "bj-table__loading", role: "status", children: [
605
- /* @__PURE__ */ f("img", { alt: "", className: "bj-table__loading-indicator", src: ar }),
606
- /* @__PURE__ */ f("span", { className: "bj-table__loading-text", children: "加载中..." })
653
+ Ge && /* @__PURE__ */ b("div", { className: "bj-table__footer", children: Ge(S) }),
654
+ ye && /* @__PURE__ */ E("div", { "aria-live": "polite", "aria-busy": "true", className: "bj-table__loading", role: "status", children: [
655
+ /* @__PURE__ */ b("img", { alt: "", className: "bj-table__loading-indicator", src: hr }),
656
+ /* @__PURE__ */ b("span", { className: "bj-table__loading-text", children: "加载中..." })
607
657
  ] }),
608
- i && z.length > 0 && /* @__PURE__ */ f("div", { className: "bj-table__pagination", children: /* @__PURE__ */ f(
609
- Yt,
658
+ n && S.length > 0 && /* @__PURE__ */ b("div", { className: "bj-table__pagination", children: /* @__PURE__ */ b(
659
+ sr,
610
660
  {
611
661
  align: "end",
612
- disabled: ue || i.disabled,
662
+ disabled: ye || n.disabled,
613
663
  current: H,
614
- defaultCurrent: i.defaultCurrent,
615
- defaultPageSize: i.defaultPageSize,
616
- dropdownClassName: i.dropdownClassName,
617
- hideOnSinglePage: i.hideOnSinglePage,
664
+ defaultCurrent: n.defaultCurrent,
665
+ defaultPageSize: n.defaultPageSize,
666
+ dropdownClassName: n.dropdownClassName,
667
+ hideOnSinglePage: n.hideOnSinglePage,
618
668
  onChange: (e) => {
619
- if (Pe.current) {
620
- Pe.current = !1;
669
+ if (Be.current) {
670
+ Be.current = !1;
621
671
  return;
622
672
  }
623
- Lt(e);
673
+ Qt(e);
624
674
  },
625
- onShowSizeChange: (e, t) => At(t),
626
- pageSize: q,
627
- pageSizeOptions: i.pageSizeOptions,
628
- popupPlacement: i.popupPlacement,
629
- resolvePopupPlacement: i.resolvePopupPlacement,
630
- showQuickJumper: i.showQuickJumper,
631
- showSizeChanger: i.showSizeChanger,
632
- showTotal: i.showTotal,
633
- simple: i.simple,
634
- size: i.size,
635
- t: i.t ?? X,
636
- total: We
675
+ onShowSizeChange: (e, t) => Zt(t),
676
+ pageSize: W,
677
+ pageSizeOptions: n.pageSizeOptions,
678
+ popupPlacement: n.popupPlacement,
679
+ resolvePopupPlacement: n.resolvePopupPlacement,
680
+ showQuickJumper: n.showQuickJumper,
681
+ showSizeChanger: n.showSizeChanger,
682
+ showTotal: n.showTotal,
683
+ simple: n.simple,
684
+ size: n.size,
685
+ t: n.t ?? C,
686
+ total: et
637
687
  }
638
688
  ) })
639
689
  ]
640
690
  }
641
691
  );
642
692
  }
643
- const ht = pr;
644
- ht.Column = nr;
645
- ht.ColumnGroup = lr;
693
+ const pt = Dr;
694
+ pt.Column = _r;
695
+ pt.ColumnGroup = ur;
646
696
  export {
647
- ht as BTable
697
+ pt as BTable
648
698
  };