bj-web-components 0.2.26 → 0.2.27

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 (109) hide show
  1. package/dist/favicon.ico +0 -0
  2. package/dist/file.svg +1 -0
  3. package/dist/globe.svg +1 -0
  4. package/dist/index.d.ts +1141 -0
  5. package/dist/index.js +1 -0
  6. package/dist/index.mjs +51 -0
  7. package/dist/miniapp.d.ts +1 -0
  8. package/dist/miniapp.js +1 -0
  9. package/dist/miniapp.mjs +1 -0
  10. package/dist/mobile.d.ts +1 -0
  11. package/dist/mobile.js +1 -0
  12. package/dist/mobile.mjs +1 -0
  13. package/dist/next.svg +1 -0
  14. package/dist/react.d.ts +1 -0
  15. package/dist/react.js +1 -0
  16. package/dist/react.mjs +1 -0
  17. package/dist/shared.d.ts +1 -0
  18. package/dist/shared.js +1 -0
  19. package/dist/shared.mjs +1 -0
  20. package/dist/style.css +1 -0
  21. package/dist/vercel.svg +1 -0
  22. package/dist/web/BasicInput/BInput.js +1 -0
  23. package/dist/web/BasicInput/BInput.mjs +177 -0
  24. package/dist/web/BasicInput/utils.js +1 -0
  25. package/dist/web/BasicInput/utils.mjs +37 -0
  26. package/dist/web/CategoryDropdown/CategoryDropdown.js +1 -0
  27. package/dist/web/CategoryDropdown/CategoryDropdown.mjs +260 -0
  28. package/dist/web/CheckBox/BCheckBox.js +1 -0
  29. package/dist/web/CheckBox/BCheckBox.mjs +101 -0
  30. package/dist/web/CheckBox/Group.js +1 -0
  31. package/dist/web/CheckBox/Group.mjs +67 -0
  32. package/dist/web/CheckBox/context.js +1 -0
  33. package/dist/web/CheckBox/context.mjs +5 -0
  34. package/dist/web/CheckBox/index.js +1 -0
  35. package/dist/web/CheckBox/index.mjs +8 -0
  36. package/dist/web/Dropdown/BDropdown.js +1 -0
  37. package/dist/web/Dropdown/BDropdown.mjs +160 -0
  38. package/dist/web/EmptyInputBox/EmptyInputBox.js +1 -0
  39. package/dist/web/EmptyInputBox/EmptyInputBox.mjs +74 -0
  40. package/dist/web/FileCard/FileCard.js +1 -0
  41. package/dist/web/FileCard/FileCard.mjs +128 -0
  42. package/dist/web/Icon/Icon.js +1 -0
  43. package/dist/web/Icon/Icon.mjs +10 -0
  44. package/dist/web/Input/Input.js +1 -0
  45. package/dist/web/Input/Input.mjs +173 -0
  46. package/dist/web/InputNumber/BInputNumber.js +1 -0
  47. package/dist/web/InputNumber/BInputNumber.mjs +204 -0
  48. package/dist/web/InputNumber/StepHandler.js +1 -0
  49. package/dist/web/InputNumber/StepHandler.mjs +64 -0
  50. package/dist/web/InputNumber/hooks/useCursor.js +1 -0
  51. package/dist/web/InputNumber/hooks/useCursor.mjs +39 -0
  52. package/dist/web/InputNumber/hooks/useFrame.js +1 -0
  53. package/dist/web/InputNumber/hooks/useFrame.mjs +10 -0
  54. package/dist/web/InputNumber/utils/decimal.js +1 -0
  55. package/dist/web/InputNumber/utils/decimal.mjs +119 -0
  56. package/dist/web/Modal/Modal.js +1 -0
  57. package/dist/web/Modal/Modal.mjs +82 -0
  58. package/dist/web/OverlayScrollbar/BOverlayScrollbar.js +1 -0
  59. package/dist/web/OverlayScrollbar/BOverlayScrollbar.mjs +152 -0
  60. package/dist/web/Pagination/Pagination.js +1 -0
  61. package/dist/web/Pagination/Pagination.mjs +253 -0
  62. package/dist/web/ProductField/ProductField.js +1 -0
  63. package/dist/web/ProductField/ProductField.mjs +226 -0
  64. package/dist/web/ProductField/arrow-up.svg.js +1 -0
  65. package/dist/web/ProductField/arrow-up.svg.mjs +4 -0
  66. package/dist/web/ProductField/checkbox-no.svg.js +1 -0
  67. package/dist/web/ProductField/checkbox-no.svg.mjs +4 -0
  68. package/dist/web/ProductField/checkbox-ok.svg.js +1 -0
  69. package/dist/web/ProductField/checkbox-ok.svg.mjs +4 -0
  70. package/dist/web/ProductField/no_data_light.svg.js +1 -0
  71. package/dist/web/ProductField/no_data_light.svg.mjs +4 -0
  72. package/dist/web/ProductField/search.svg.js +1 -0
  73. package/dist/web/ProductField/search.svg.mjs +4 -0
  74. package/dist/web/ProductField/sort.svg.js +1 -0
  75. package/dist/web/ProductField/sort.svg.mjs +4 -0
  76. package/dist/web/SkuInputCard/SkuInputCard.js +1 -0
  77. package/dist/web/SkuInputCard/SkuInputCard.mjs +238 -0
  78. package/dist/web/SkuInputCard/spin_loading_red.gif.js +1 -0
  79. package/dist/web/SkuInputCard/spin_loading_red.gif.mjs +4 -0
  80. package/dist/web/Switch/Switch.js +1 -0
  81. package/dist/web/Switch/Switch.mjs +61 -0
  82. package/dist/web/Table/BTable.js +1 -0
  83. package/dist/web/Table/BTable.mjs +698 -0
  84. package/dist/web/Table/Column.js +1 -0
  85. package/dist/web/Table/Column.mjs +6 -0
  86. package/dist/web/Table/ColumnGroup.js +1 -0
  87. package/dist/web/Table/ColumnGroup.mjs +6 -0
  88. package/dist/web/Table/utils/columns.js +1 -0
  89. package/dist/web/Table/utils/columns.mjs +43 -0
  90. package/dist/web/Table/utils/sortFilter.js +1 -0
  91. package/dist/web/Table/utils/sortFilter.mjs +63 -0
  92. package/dist/web/Tabs/BTabs.js +1 -0
  93. package/dist/web/Tabs/BTabs.mjs +130 -0
  94. package/dist/web/Tabs/TabPane.js +1 -0
  95. package/dist/web/Tabs/TabPane.mjs +8 -0
  96. package/dist/web/Tooltip/ConfirmTooltip.js +1 -0
  97. package/dist/web/Tooltip/ConfirmTooltip.mjs +26 -0
  98. package/dist/web/Tooltip/ContentTooltip.js +1 -0
  99. package/dist/web/Tooltip/ContentTooltip.mjs +85 -0
  100. package/dist/web/Tooltip/ProgressTooltip.js +1 -0
  101. package/dist/web/Tooltip/ProgressTooltip.mjs +35 -0
  102. package/dist/web/Tooltip/TooltipWrapper.js +1 -0
  103. package/dist/web/Tooltip/TooltipWrapper.mjs +13 -0
  104. package/dist/web/Tooltip/useAutoPlacement.js +1 -0
  105. package/dist/web/Tooltip/useAutoPlacement.mjs +32 -0
  106. package/dist/web.d.ts +1141 -0
  107. package/dist/web.js +1 -0
  108. package/dist/web.mjs +51 -0
  109. package/package.json +1 -1
@@ -0,0 +1,698 @@
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
+ /* empty css */
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
+ /* empty css */
19
+ const vr = 300, Te = 1;
20
+ function L(...m) {
21
+ return m.filter(Boolean).join(" ");
22
+ }
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
+ }
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
+ }
37
+ return j;
38
+ }
39
+ function Nr(m, j) {
40
+ return Math.max(1, Math.ceil(m / j));
41
+ }
42
+ function Rr(m) {
43
+ return !!(m && typeof m == "object" && !ar(m) && "props" in m);
44
+ }
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
+ }
48
+ function gt({
49
+ checked: m,
50
+ disabled: j,
51
+ label: g,
52
+ name: D,
53
+ onChange: d,
54
+ type: A = "checkbox"
55
+ }) {
56
+ return A === "checkbox" ? /* @__PURE__ */ b(
57
+ fr,
58
+ {
59
+ "aria-label": g,
60
+ checked: m,
61
+ className: "bj-table__selection-checkbox",
62
+ disabled: j,
63
+ name: D,
64
+ onChange: d,
65
+ skipGroup: !0
66
+ }
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
+ "input",
70
+ {
71
+ "aria-label": g,
72
+ checked: m,
73
+ className: "bj-table__selection-input",
74
+ disabled: j,
75
+ name: D,
76
+ onChange: d,
77
+ type: A
78
+ }
79
+ ),
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
+ ] });
82
+ }
83
+ function Dr({
84
+ columns: m,
85
+ dataSource: j = [],
86
+ rowKey: g,
87
+ preserveSelectedRowKeys: D = !1,
88
+ rowSelection: d,
89
+ pagination: A = !1,
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
+ onChange: pe,
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
+ groupCollapse: h
115
+ }) {
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
+ A ? A.defaultCurrent ?? 1 : 1
124
+ ), [kt, Ot] = R(
125
+ A ? A.defaultPageSize ?? 10 : 10
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
+ h != null && h.defaultExpandedKeys ? [...h.defaultExpandedKeys] : []
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
+ if ("children" in e) return;
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
+ });
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
+ };
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
+ return;
155
+ }
156
+ const e = () => {
157
+ const t = J.getBoundingClientRect();
158
+ He({ left: t.left, top: t.bottom + 4 });
159
+ };
160
+ return e(), document.addEventListener("scroll", e, !0), window.addEventListener("resize", e), () => {
161
+ document.removeEventListener("scroll", e, !0), window.removeEventListener("resize", e);
162
+ };
163
+ }, [J, I]), Y(() => {
164
+ if (I === null) return;
165
+ const e = (t) => {
166
+ const r = t.target;
167
+ J != null && J.contains(r) || r.closest(".bj-table__filter-dropdown") || (U(null), De(null));
168
+ };
169
+ return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
170
+ }, [J, I]), Y(() => {
171
+ const e = window.setTimeout(
172
+ () => Je(Pe.trim()),
173
+ vr
174
+ );
175
+ return () => window.clearTimeout(e);
176
+ }, [Pe]), Y(() => {
177
+ if (I === null) return;
178
+ const e = re.find((r, s) => O(r, s) === I);
179
+ if (!e || "children" in e || !e.filterRequest) return;
180
+ const t = ++Oe.current;
181
+ Promise.resolve().then(() => e.filterRequest(ae)).then(
182
+ (r) => {
183
+ Oe.current === t && ke(r);
184
+ },
185
+ () => {
186
+ Oe.current === t && ke([]);
187
+ }
188
+ );
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
+ );
198
+ });
199
+ const e = (H - 1) * W;
200
+ return S.slice(e, e + W).map((t, r) => ({
201
+ record: t,
202
+ index: e + r
203
+ })).filter(({ record: t, index: r }) => {
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
+ );
209
+ });
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);
257
+ pe == null || pe(
258
+ { ...n, current: s, pageSize: l, total: (n == null ? void 0 : n.total) ?? _.length },
259
+ a,
260
+ jr(y, t),
261
+ { action: e, currentDataSource: _ }
262
+ );
263
+ }, Wt = (e, t) => {
264
+ if (!e.sorter) return;
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);
278
+ return;
279
+ }
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({
289
+ prefixCls: "bj-table",
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);
294
+ },
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);
298
+ },
299
+ filters: e.filters,
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(
304
+ "span",
305
+ {
306
+ "aria-label": "表头提示",
307
+ className: "bj-table__column-badge-trigger",
308
+ id: s,
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),
315
+ role: "button",
316
+ tabIndex: 0,
317
+ children: /* @__PURE__ */ b("span", { "aria-hidden": "true", className: "bj-table__column-badge-shape" })
318
+ }
319
+ ),
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 }) })
323
+ ] }),
324
+ (e.filters || e.filterDropdown) && /* @__PURE__ */ E("div", { className: "bj-table__filter", children: [
325
+ /* @__PURE__ */ b(
326
+ "button",
327
+ {
328
+ "aria-expanded": _,
329
+ "aria-label": "筛选",
330
+ className: L("bj-table__filter-trigger", o && "bj-table__filter-trigger--active"),
331
+ onClick: (c) => {
332
+ c.stopPropagation(), ue(e, t);
333
+ },
334
+ type: "button",
335
+ children: typeof e.filterIcon == "function" ? e.filterIcon(o) : e.filterIcon ?? /* @__PURE__ */ b(Le, { className: "bj-table__filter-icon", type: "icon-a-shaixuanxi" })
336
+ }
337
+ ),
338
+ _ && Ee && typeof document < "u" && nr(
339
+ /* @__PURE__ */ b(
340
+ "div",
341
+ {
342
+ className: "bj-table__filter-dropdown",
343
+ onClick: (c) => c.stopPropagation(),
344
+ role: "dialog",
345
+ style: { left: Ee.left, top: Ee.top },
346
+ children: Z ?? /* @__PURE__ */ b(
347
+ cr,
348
+ {
349
+ ...e.filterDropdownProps,
350
+ emptyText: (ee == null ? void 0 : ee.filterEmptyText) ?? C("暂无结果"),
351
+ multiple: e.filterMultiple !== !1,
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);
355
+ },
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);
359
+ },
360
+ onReset: () => {
361
+ var c, x;
362
+ $t(e, t), (x = (c = e.filterDropdownProps) == null ? void 0 : c.onReset) == null || x.call(c);
363
+ },
364
+ onSearch: (c) => {
365
+ var x, k;
366
+ Ue(c), (k = (x = e.filterDropdownProps) == null ? void 0 : x.onSearch) == null || k.call(x, c);
367
+ },
368
+ options: T.map((c) => ({
369
+ label: c.text,
370
+ description: c.description,
371
+ value: c.value
372
+ })),
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
378
+ }
379
+ )
380
+ }
381
+ ),
382
+ document.body
383
+ )
384
+ ] })
385
+ ] });
386
+ return e.badge !== void 0 ? /* @__PURE__ */ E(
387
+ dr,
388
+ {
389
+ className: "bj-table__column-tooltip-wrapper",
390
+ children: [
391
+ /* @__PURE__ */ b("div", { className: "bj-table__column-tooltip-trigger", children: z }),
392
+ Lt === r && /* @__PURE__ */ b(
393
+ lr,
394
+ {
395
+ className: "bj-table__column-tooltip",
396
+ content: e.badge,
397
+ getAnchorElement: () => document.getElementById(s),
398
+ getPopupContainer: () => document.body,
399
+ placement: "top"
400
+ }
401
+ )
402
+ ]
403
+ }
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))
410
+ );
411
+ (a = t.onChange) == null || a.call(t, e, l), r && ((i = t.onSelect) == null || i.call(
412
+ t,
413
+ r,
414
+ s.has(q(r, j.indexOf(r), g)),
415
+ l
416
+ ));
417
+ }, Ut = (e, t) => {
418
+ if (!d)
419
+ return;
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(
423
+ ({ record: e }) => {
424
+ var t;
425
+ return !((t = d == null ? void 0 : d.getCheckboxProps) != null && t.call(d, e).disabled);
426
+ }
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 = () => {
430
+ var r;
431
+ if (!d || d.type === "radio")
432
+ return;
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)
438
+ );
439
+ }, Qt = (e) => {
440
+ var t;
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) => {
443
+ var r, s;
444
+ if (!n || e === W)
445
+ return;
446
+ const t = 1;
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) => {
449
+ const r = e.fixed === !0 ? "left" : e.fixed;
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,
453
+ minWidth: "100%",
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(
457
+ "div",
458
+ {
459
+ id: Et,
460
+ ref: fe,
461
+ className: L(
462
+ "bj-table",
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
470
+ ),
471
+ style: Ft,
472
+ children: [
473
+ we && /* @__PURE__ */ b("div", { className: "bj-table__title", children: we(S) }),
474
+ /* @__PURE__ */ E("div", { className: "bj-table__viewport", children: [
475
+ /* @__PURE__ */ b(
476
+ "div",
477
+ {
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))
485
+ ] }),
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,
489
+ {
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,
498
+ scope: "col",
499
+ style: { width: le },
500
+ children: [
501
+ d.type !== "radio" && /* @__PURE__ */ b(
502
+ gt,
503
+ {
504
+ checked: Se,
505
+ disabled: se.length === 0,
506
+ onChange: Jt,
507
+ label: "选择当前页所有行"
508
+ }
509
+ ),
510
+ d.columnTitle
511
+ ]
512
+ }
513
+ ),
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);
518
+ };
519
+ return /* @__PURE__ */ Me(
520
+ ft,
521
+ {
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(
526
+ "bj-table__header-cell",
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
537
+ ),
538
+ colSpan: s,
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());
543
+ },
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());
547
+ },
548
+ rowSpan: l,
549
+ scope: "col",
550
+ style: { textAlign: i.align, ...dt(i, o) },
551
+ tabIndex: p || u ? 0 : void 0
552
+ },
553
+ "children" in r ? mt(r.title, { filters: Object.fromEntries(K) }) : Ht(i, o)
554
+ );
555
+ })
556
+ ] }, t)) }),
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,
562
+ {
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),
565
+ key: r
566
+ },
567
+ d && !s && /* @__PURE__ */ b(
568
+ ze,
569
+ {
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,
580
+ {
581
+ checked: a,
582
+ disabled: l,
583
+ label: `选择第 ${t + 1} 行`,
584
+ name: d.type === "radio" ? "bj-table-row-selection" : void 0,
585
+ onChange: () => Ut(e, t),
586
+ type: d.type ?? "checkbox"
587
+ }
588
+ )
589
+ }
590
+ ),
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,
597
+ {
598
+ ...v,
599
+ className: L(
600
+ "bj-table__cell",
601
+ ((M = y[p + 1]) == null ? void 0 : M.fixed) === "right" && "bj-table__cell--before-fixed-right",
602
+ s && "bj-table__cell--group",
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
611
+ ),
612
+ key: u.key ?? String(u.dataIndex ?? p),
613
+ colSpan: s ? st : v.colSpan,
614
+ style: { textAlign: u.align, ...dt(u, p), ...v.style }
615
+ },
616
+ s ? ((c = h == null ? void 0 : h.render) == null ? void 0 : c.call(h, {
617
+ record: e,
618
+ expanded: Q.includes(oe(e, t)),
619
+ onToggle: () => Gt(e, t)
620
+ })) ?? z ?? "" : /* @__PURE__ */ b("div", { className: "bj-table__cell-content", children: z ?? "" })
621
+ );
622
+ })
623
+ );
624
+ }) : /* @__PURE__ */ b(ct, { className: "bj-table__empty-row", children: /* @__PURE__ */ b(
625
+ ze,
626
+ {
627
+ className: "bj-table__empty-cell",
628
+ colSpan: Math.max(st, 1),
629
+ style: { height: Nt }
630
+ }
631
+ ) }) }),
632
+ qe && /* @__PURE__ */ b("tfoot", { className: "bj-table__summary", children: qe(S) })
633
+ ] })
634
+ }
635
+ ),
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 })
639
+ ] }) })
640
+ ] }),
641
+ ((f == null ? void 0 : f.x) || (f == null ? void 0 : f.y)) && /* @__PURE__ */ b(
642
+ br,
643
+ {
644
+ containerRef: fe,
645
+ direction: f != null && f.x && (f != null && f.y) ? "both" : f != null && f.x ? "horizontal" : "vertical",
646
+ gap: 2,
647
+ horizontalInsetEnd: Qe.end,
648
+ horizontalInsetStart: Qe.start,
649
+ size: 4,
650
+ targetRef: Re
651
+ }
652
+ ),
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: "加载中..." })
657
+ ] }),
658
+ n && S.length > 0 && /* @__PURE__ */ b("div", { className: "bj-table__pagination", children: /* @__PURE__ */ b(
659
+ sr,
660
+ {
661
+ align: "end",
662
+ disabled: ye || n.disabled,
663
+ current: H,
664
+ defaultCurrent: n.defaultCurrent,
665
+ defaultPageSize: n.defaultPageSize,
666
+ dropdownClassName: n.dropdownClassName,
667
+ hideOnSinglePage: n.hideOnSinglePage,
668
+ onChange: (e) => {
669
+ if (Be.current) {
670
+ Be.current = !1;
671
+ return;
672
+ }
673
+ Qt(e);
674
+ },
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
687
+ }
688
+ ) })
689
+ ]
690
+ }
691
+ );
692
+ }
693
+ const pt = Dr;
694
+ pt.Column = _r;
695
+ pt.ColumnGroup = ur;
696
+ export {
697
+ pt as BTable
698
+ };