bj-web-components 0.2.28 → 0.2.30

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 (90) hide show
  1. package/dist/index.js +1 -51
  2. package/dist/index.mjs +49 -49
  3. package/dist/style.css +1 -3744
  4. package/dist/web/BasicInput/BInput.js +1 -208
  5. package/dist/web/BasicInput/BInput.mjs +132 -164
  6. package/dist/web/BasicInput/utils.js +1 -47
  7. package/dist/web/BasicInput/utils.mjs +28 -38
  8. package/dist/web/CategoryDropdown/CategoryDropdown.js +1 -307
  9. package/dist/web/CategoryDropdown/CategoryDropdown.mjs +170 -218
  10. package/dist/web/CheckBox/BCheckBox.js +1 -116
  11. package/dist/web/CheckBox/BCheckBox.mjs +70 -86
  12. package/dist/web/CheckBox/Group.js +1 -73
  13. package/dist/web/CheckBox/Group.mjs +56 -63
  14. package/dist/web/CheckBox/context.js +1 -5
  15. package/dist/web/CheckBox/context.mjs +3 -3
  16. package/dist/web/CheckBox/index.js +1 -8
  17. package/dist/web/CheckBox/index.mjs +6 -6
  18. package/dist/web/Dropdown/BDropdown.js +1 -186
  19. package/dist/web/Dropdown/BDropdown.mjs +106 -132
  20. package/dist/web/EmptyInputBox/EmptyInputBox.js +1 -77
  21. package/dist/web/EmptyInputBox/EmptyInputBox.mjs +48 -52
  22. package/dist/web/FileCard/FileCard.js +1 -157
  23. package/dist/web/FileCard/FileCard.mjs +82 -112
  24. package/dist/web/Icon/Icon.js +1 -9
  25. package/dist/web/Icon/Icon.mjs +6 -6
  26. package/dist/web/Input/Input.js +1 -181
  27. package/dist/web/Input/Input.mjs +113 -122
  28. package/dist/web/InputNumber/BInputNumber.js +1 -311
  29. package/dist/web/InputNumber/BInputNumber.mjs +167 -275
  30. package/dist/web/InputNumber/StepHandler.js +1 -69
  31. package/dist/web/InputNumber/StepHandler.mjs +32 -38
  32. package/dist/web/InputNumber/hooks/useCursor.js +1 -40
  33. package/dist/web/InputNumber/hooks/useCursor.mjs +33 -35
  34. package/dist/web/InputNumber/hooks/useFrame.js +1 -12
  35. package/dist/web/InputNumber/hooks/useFrame.mjs +6 -9
  36. package/dist/web/InputNumber/utils/decimal.js +1 -147
  37. package/dist/web/InputNumber/utils/decimal.mjs +81 -109
  38. package/dist/web/Modal/Modal.js +1 -84
  39. package/dist/web/Modal/Modal.mjs +49 -52
  40. package/dist/web/OverlayScrollbar/BOverlayScrollbar.js +1 -232
  41. package/dist/web/OverlayScrollbar/BOverlayScrollbar.mjs +125 -206
  42. package/dist/web/Pagination/Pagination.js +1 -328
  43. package/dist/web/Pagination/Pagination.mjs +178 -254
  44. package/dist/web/ProductField/ProductField.js +1 -272
  45. package/dist/web/ProductField/ProductField.mjs +143 -190
  46. package/dist/web/ProductField/arrow-up.svg.js +1 -3
  47. package/dist/web/ProductField/arrow-up.svg.mjs +2 -2
  48. package/dist/web/ProductField/checkbox-no.svg.js +1 -3
  49. package/dist/web/ProductField/checkbox-no.svg.mjs +2 -2
  50. package/dist/web/ProductField/checkbox-ok.svg.js +1 -3
  51. package/dist/web/ProductField/checkbox-ok.svg.mjs +2 -2
  52. package/dist/web/ProductField/no_data_light.svg.js +1 -3
  53. package/dist/web/ProductField/no_data_light.svg.mjs +2 -2
  54. package/dist/web/ProductField/search.svg.js +1 -3
  55. package/dist/web/ProductField/search.svg.mjs +2 -2
  56. package/dist/web/ProductField/sort.svg.js +1 -3
  57. package/dist/web/ProductField/sort.svg.mjs +2 -2
  58. package/dist/web/SkuInputCard/SkuInputCard.js +1 -276
  59. package/dist/web/SkuInputCard/SkuInputCard.mjs +149 -188
  60. package/dist/web/SkuInputCard/spin_loading_red.gif.js +1 -3
  61. package/dist/web/SkuInputCard/spin_loading_red.gif.mjs +2 -2
  62. package/dist/web/Switch/Switch.js +1 -70
  63. package/dist/web/Switch/Switch.mjs +37 -47
  64. package/dist/web/Table/BTable.js +1 -950
  65. package/dist/web/Table/BTable.mjs +521 -767
  66. package/dist/web/Table/Column.js +1 -5
  67. package/dist/web/Table/Column.mjs +2 -2
  68. package/dist/web/Table/ColumnGroup.js +1 -5
  69. package/dist/web/Table/ColumnGroup.mjs +2 -2
  70. package/dist/web/Table/utils/columns.js +1 -48
  71. package/dist/web/Table/utils/columns.mjs +30 -35
  72. package/dist/web/Table/utils/sortFilter.js +1 -84
  73. package/dist/web/Table/utils/sortFilter.mjs +52 -73
  74. package/dist/web/Tabs/BTabs.js +1 -150
  75. package/dist/web/Tabs/BTabs.mjs +98 -118
  76. package/dist/web/Tabs/TabPane.js +1 -8
  77. package/dist/web/Tabs/TabPane.mjs +4 -4
  78. package/dist/web/Tooltip/ConfirmTooltip.js +1 -26
  79. package/dist/web/Tooltip/ConfirmTooltip.mjs +19 -20
  80. package/dist/web/Tooltip/ContentTooltip.js +1 -94
  81. package/dist/web/Tooltip/ContentTooltip.mjs +62 -72
  82. package/dist/web/Tooltip/ProgressTooltip.js +1 -36
  83. package/dist/web/Tooltip/ProgressTooltip.mjs +20 -22
  84. package/dist/web/Tooltip/TooltipWrapper.js +1 -12
  85. package/dist/web/Tooltip/TooltipWrapper.mjs +8 -8
  86. package/dist/web/Tooltip/useAutoPlacement.js +1 -41
  87. package/dist/web/Tooltip/useAutoPlacement.mjs +25 -34
  88. package/dist/web.js +1 -51
  89. package/dist/web.mjs +49 -49
  90. package/package.json +1 -1
@@ -1,537 +1,386 @@
1
- import { jsxs, jsx } from "react/jsx-runtime";
2
- import { useRef, useMemo, useState, useEffect, createElement, isValidElement } from "react";
3
- import { createPortal } from "react-dom";
4
- import Pagination from "../Pagination/Pagination.mjs";
5
- import BuIcon 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 BTooltip from "../Tooltip/ContentTooltip.mjs";
8
- import TooltipWrapper from "../Tooltip/TooltipWrapper.mjs";
9
- import { BCheckBox as CompoundBCheckBox } from "../CheckBox/index.mjs";
10
- import { BDropdown } from "../Dropdown/BDropdown.mjs";
11
- import BOverlayScrollbar from "../OverlayScrollbar/BOverlayScrollbar.mjs";
12
- import loadingIndicator from "../SkuInputCard/spin_loading_red.gif.mjs";
13
- import defaultEmptyImage from "../ProductField/no_data_light.svg.mjs";
14
- import Column from "./Column.mjs";
15
- import ColumnGroup from "./ColumnGroup.mjs";
16
- import { getColumnKey, filterRecords, sortRecords, renderColumnTitle, getNextSortOrder, getSorterResult } from "./utils/sortFilter.mjs";
17
- import { convertChildrenToColumns, flattenColumns, buildHeaderRows } 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 FILTER_SEARCH_DEBOUNCE_MS = 300;
20
- const SCROLL_EDGE_THRESHOLD = 1;
21
- function classNames(...values) {
22
- return values.filter(Boolean).join(" ");
19
+ const vr = 300, Te = 1;
20
+ function L(...m) {
21
+ return m.filter(Boolean).join(" ");
23
22
  }
24
- function getValue(record, dataIndex) {
25
- if (dataIndex === void 0) {
26
- return void 0;
27
- }
28
- const path = Array.isArray(dataIndex) ? dataIndex : [dataIndex];
29
- return path.reduce((value, key) => {
30
- if (value === null || value === void 0 || typeof value !== "object") {
31
- return void 0;
32
- }
33
- return value[key];
34
- }, record);
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);
35
28
  }
36
- function getRowKey(record, index, rowKey) {
37
- if (typeof rowKey === "function") {
38
- return rowKey(record, index);
39
- }
40
- if (rowKey) {
41
- const value = record[String(rowKey)];
42
- if (typeof value === "string" || typeof value === "number") {
43
- return value;
44
- }
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;
45
36
  }
46
- return index;
37
+ return j;
47
38
  }
48
- function getPageCount(total, pageSize) {
49
- return Math.max(1, Math.ceil(total / pageSize));
39
+ function Nr(m, j) {
40
+ return Math.max(1, Math.ceil(m / j));
50
41
  }
51
- function isRenderedCell(value) {
52
- return Boolean(value && typeof value === "object" && !isValidElement(value) && "props" in value);
42
+ function Rr(m) {
43
+ return !!(m && typeof m == "object" && !ar(m) && "props" in m);
53
44
  }
54
- function defaultFilterSearch(input, item) {
55
- const searchableText = typeof item.text === "string" || typeof item.text === "number" ? String(item.text) : String(item.value);
56
- return searchableText.toLocaleLowerCase().includes(input.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());
57
47
  }
58
- function SelectionControl({
59
- checked,
60
- disabled,
61
- label,
62
- name,
63
- onChange,
64
- type = "checkbox"
48
+ function gt({
49
+ checked: m,
50
+ disabled: j,
51
+ label: g,
52
+ name: D,
53
+ onChange: d,
54
+ type: A = "checkbox"
65
55
  }) {
66
- if (type === "checkbox") {
67
- return /* @__PURE__ */ jsx(
68
- CompoundBCheckBox,
69
- {
70
- "aria-label": label,
71
- checked,
72
- className: "bj-table__selection-checkbox",
73
- disabled,
74
- name,
75
- onChange,
76
- skipGroup: true
77
- }
78
- );
79
- }
80
- return /* @__PURE__ */ jsxs("label", { className: classNames("bj-table__selection-control", checked && "bj-table__selection-control--checked", disabled && "bj-table__selection-control--disabled"), children: [
81
- /* @__PURE__ */ jsx(
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(
82
69
  "input",
83
70
  {
84
- "aria-label": label,
85
- checked,
71
+ "aria-label": g,
72
+ checked: m,
86
73
  className: "bj-table__selection-input",
87
- disabled,
88
- name,
89
- onChange,
90
- type
74
+ disabled: j,
75
+ name: D,
76
+ onChange: d,
77
+ type: A
91
78
  }
92
79
  ),
93
- /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: "bj-table__selection-box", children: checked && /* @__PURE__ */ jsx(BuIcon, { 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" }) })
94
81
  ] });
95
82
  }
96
- function BTable({
97
- columns,
98
- dataSource = [],
99
- rowKey,
100
- preserveSelectedRowKeys = false,
101
- rowSelection,
102
- pagination = false,
103
- loading = false,
104
- bordered = true,
105
- size = "middle",
106
- showHeader = true,
107
- emptyText,
108
- emptyImage = defaultEmptyImage,
109
- emptyHeight,
110
- t = (text) => text,
111
- className,
112
- style,
113
- rowClassName,
114
- sortDirections = ["ascend", "descend", null],
115
- onChange,
116
- children,
117
- title,
118
- footer,
119
- summary,
120
- tableLayout,
121
- components,
122
- onRow,
123
- onHeaderRow,
124
- id,
125
- scroll,
126
- locale,
127
- groupCollapse
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
128
115
  }) {
129
- var _a, _b, _c;
130
- const tableRootRef = useRef(null);
131
- const tableScrollRef = useRef(null);
132
- const mergedColumns = useMemo(
133
- () => columns ?? convertChildrenToColumns(children),
134
- [children, columns]
135
- );
136
- const leafColumns = useMemo(() => flattenColumns(mergedColumns), [mergedColumns]);
137
- const headerRows = useMemo(() => buildHeaderRows(mergedColumns), [mergedColumns]);
138
- const [uncontrolledSelectedKeys, setUncontrolledSelectedKeys] = useState(
139
- (rowSelection == null ? void 0 : rowSelection.defaultSelectedRowKeys) ?? []
140
- );
141
- const [uncontrolledCurrent, setUncontrolledCurrent] = useState(
142
- pagination ? pagination.defaultCurrent ?? 1 : 1
143
- );
144
- const [uncontrolledPageSize, setUncontrolledPageSize] = useState(
145
- pagination ? pagination.defaultPageSize ?? 10 : 10
146
- );
147
- const [uncontrolledSortOrders, setUncontrolledSortOrders] = useState(
148
- () => new Map(leafColumns.flatMap((column, index) => {
149
- if (!column.defaultSortOrder) return [];
150
- return [[getColumnKey(column, index), column.defaultSortOrder]];
151
- }))
152
- );
153
- const [uncontrolledFilters, setUncontrolledFilters] = useState(
154
- () => new Map(leafColumns.flatMap((column, index) => {
155
- if (column.defaultFilteredValue === void 0) return [];
156
- return [[getColumnKey(column, index), column.defaultFilteredValue]];
157
- }))
158
- );
159
- const [uncontrolledExpandedGroupKeys, setUncontrolledExpandedGroupKeys] = useState(
160
- (groupCollapse == null ? void 0 : groupCollapse.defaultExpandedKeys) ? [...groupCollapse.defaultExpandedKeys] : []
161
- );
162
- const [openFilterKey, setOpenFilterKey] = useState(null);
163
- const [draftFilters, setDraftFilters] = useState(/* @__PURE__ */ new Map());
164
- const [hoveredBadgeKey, setHoveredBadgeKey] = useState(null);
165
- const tableInstanceIdRef = useRef(`btable-${Math.random().toString(36).slice(2, 10)}`);
166
- const tableInstanceId = tableInstanceIdRef.current;
167
- const [filterAnchor, setFilterAnchor] = useState(null);
168
- const [filterPopupPosition, setFilterPopupPosition] = useState(null);
169
- const [filterSearchInput, setFilterSearchInput] = useState("");
170
- const [debouncedFilterSearch, setDebouncedFilterSearch] = useState("");
171
- const [requestedFilterOptions, setRequestedFilterOptions] = useState();
172
- const filterRequestIdRef = useRef(0);
173
- const ignoreNextPaginationChangeRef = useRef(false);
174
- const [horizontalInsets, setHorizontalInsets] = useState({ start: 0, end: 0 });
175
- const [scrollPing, setScrollPing] = useState({ start: false, end: false });
176
- const paginationConfig = pagination || void 0;
177
- const pageSize = (paginationConfig == null ? void 0 : paginationConfig.pageSize) ?? uncontrolledPageSize;
178
- const selectedKeys = (rowSelection == null ? void 0 : rowSelection.selectedRowKeys) ?? uncontrolledSelectedKeys;
179
- const activeColumns = leafColumns;
180
- const fixedLayoutSignature = `${activeColumns.map((column) => `${String(column.fixed ?? "")}:${String(column.width ?? "")}`).join("|")}|${rowSelection ? String(rowSelection.columnWidth ?? "") : "-"}|${String((scroll == null ? void 0 : scroll.x) ?? "")}|${String(tableLayout ?? "")}`;
181
- const isFixedLeftColumn = (column) => Boolean(column && (column.fixed === "left" || column.fixed === true));
182
- const isFixedRightColumn = (column) => Boolean(column && column.fixed === "right");
183
- const sortOrders = new Map(uncontrolledSortOrders);
184
- const activeFilters = new Map(uncontrolledFilters);
185
- activeColumns.forEach((rawColumn, index) => {
186
- if ("children" in rawColumn) return;
187
- const key = getColumnKey(rawColumn, index);
188
- if (rawColumn.sortOrder !== void 0) sortOrders.set(key, rawColumn.sortOrder);
189
- if (rawColumn.filteredValue !== void 0) activeFilters.set(key, rawColumn.filteredValue);
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);
190
137
  });
191
- const filteredData = useMemo(
192
- () => filterRecords(dataSource, activeColumns, activeFilters),
193
- [activeColumns, activeFilters, dataSource]
194
- );
195
- const processedData = useMemo(
196
- () => sortRecords(filteredData, activeColumns, sortOrders),
197
- [activeColumns, filteredData, sortOrders]
198
- );
199
- const total = (paginationConfig == null ? void 0 : paginationConfig.total) ?? processedData.length;
200
- const pageCount = getPageCount(total, pageSize);
201
- const current = Math.min((paginationConfig == null ? void 0 : paginationConfig.current) ?? uncontrolledCurrent, pageCount);
202
- const expandedGroupKeys = (groupCollapse == null ? void 0 : groupCollapse.expandedKeys) ?? uncontrolledExpandedGroupKeys;
203
- const isGroupRow = (record, index) => (groupCollapse == null ? void 0 : groupCollapse.isGroupRow) ? groupCollapse.isGroupRow(record, index) : Boolean(record.isGroup);
204
- const getGroupKey = (record, index) => (groupCollapse == null ? void 0 : groupCollapse.groupKey) ? groupCollapse.groupKey(record, index) : record.groupId;
205
- const getChildrenKeys = (record, index) => (groupCollapse == null ? void 0 : groupCollapse.childrenKeys) ? groupCollapse.childrenKeys(record, index) : record.childrenIds ?? [];
206
- const toggleGroup = (record, index) => {
207
- var _a2;
208
- const key = getGroupKey(record, index);
209
- const expanded = expandedGroupKeys.includes(key);
210
- const nextKeys = expanded ? expandedGroupKeys.filter((expandedKey) => expandedKey !== key) : [...expandedGroupKeys, key];
211
- if ((groupCollapse == null ? void 0 : groupCollapse.expandedKeys) === void 0) setUncontrolledExpandedGroupKeys(nextKeys);
212
- (_a2 = groupCollapse == null ? void 0 : groupCollapse.onExpandedKeysChange) == null ? void 0 : _a2.call(groupCollapse, nextKeys, record, !expanded);
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);
213
148
  };
214
- useEffect(() => {
215
- if (current !== uncontrolledCurrent && (paginationConfig == null ? void 0 : paginationConfig.current) === void 0) {
216
- setUncontrolledCurrent(current);
217
- }
218
- }, [current, paginationConfig == null ? void 0 : paginationConfig.current, uncontrolledCurrent]);
219
- useEffect(() => {
220
- if (!filterAnchor || openFilterKey === null) {
221
- setFilterPopupPosition(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);
222
154
  return;
223
155
  }
224
- const updatePosition = () => {
225
- const rect = filterAnchor.getBoundingClientRect();
226
- setFilterPopupPosition({ left: rect.left, top: rect.bottom + 4 });
156
+ const e = () => {
157
+ const t = J.getBoundingClientRect();
158
+ He({ left: t.left, top: t.bottom + 4 });
227
159
  };
228
- updatePosition();
229
- document.addEventListener("scroll", updatePosition, true);
230
- window.addEventListener("resize", updatePosition);
231
- return () => {
232
- document.removeEventListener("scroll", updatePosition, true);
233
- window.removeEventListener("resize", updatePosition);
160
+ return e(), document.addEventListener("scroll", e, !0), window.addEventListener("resize", e), () => {
161
+ document.removeEventListener("scroll", e, !0), window.removeEventListener("resize", e);
234
162
  };
235
- }, [filterAnchor, openFilterKey]);
236
- useEffect(() => {
237
- if (openFilterKey === null) return;
238
- const handleOutsideClick = (event) => {
239
- const target = event.target;
240
- if ((filterAnchor == null ? void 0 : filterAnchor.contains(target)) || target.closest(".bj-table__filter-dropdown")) return;
241
- setOpenFilterKey(null);
242
- setFilterAnchor(null);
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));
243
168
  };
244
- document.addEventListener("mousedown", handleOutsideClick);
245
- return () => document.removeEventListener("mousedown", handleOutsideClick);
246
- }, [filterAnchor, openFilterKey]);
247
- useEffect(() => {
248
- const timer = window.setTimeout(
249
- () => setDebouncedFilterSearch(filterSearchInput.trim()),
250
- FILTER_SEARCH_DEBOUNCE_MS
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
251
174
  );
252
- return () => window.clearTimeout(timer);
253
- }, [filterSearchInput]);
254
- useEffect(() => {
255
- if (openFilterKey === null) return;
256
- const openColumn = leafColumns.find((column, index) => getColumnKey(column, index) === openFilterKey);
257
- if (!openColumn || "children" in openColumn || !openColumn.filterRequest) return;
258
- const requestId = ++filterRequestIdRef.current;
259
- Promise.resolve().then(() => openColumn.filterRequest(debouncedFilterSearch)).then(
260
- (options) => {
261
- if (filterRequestIdRef.current === requestId) setRequestedFilterOptions(options);
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);
262
184
  },
263
185
  () => {
264
- if (filterRequestIdRef.current === requestId) setRequestedFilterOptions([]);
186
+ Oe.current === t && ke([]);
265
187
  }
266
188
  );
267
- }, [debouncedFilterSearch, leafColumns, openFilterKey]);
268
- const visibleRecords = useMemo(() => {
269
- if (!paginationConfig || paginationConfig.serverPagination) {
270
- return processedData.map((record, index) => ({ record, index })).filter(({ record, index }) => {
271
- if (!groupCollapse || isGroupRow(record, index)) return true;
272
- const childKey = getRowKey(record, index, rowKey);
273
- return processedData.some(
274
- (group, groupIndex) => isGroupRow(group, groupIndex) && expandedGroupKeys.includes(getGroupKey(group, groupIndex)) && getChildrenKeys(group, groupIndex).includes(childKey)
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)
275
197
  );
276
198
  });
277
- }
278
- const start = (current - 1) * pageSize;
279
- return processedData.slice(start, start + pageSize).map((record, index) => ({
280
- record,
281
- index: start + index
282
- })).filter(({ record, index }) => {
283
- if (!groupCollapse || isGroupRow(record, index)) return true;
284
- const childKey = getRowKey(record, index, rowKey);
285
- return processedData.some(
286
- (group, groupIndex) => isGroupRow(group, groupIndex) && expandedGroupKeys.includes(getGroupKey(group, groupIndex)) && getChildrenKeys(group, groupIndex).includes(childKey)
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)
287
208
  );
288
209
  });
289
- }, [current, expandedGroupKeys, groupCollapse, pageSize, paginationConfig, processedData, rowKey]);
290
- const visibleSelectionKeys = useMemo(
291
- () => visibleRecords.map(({ record, index }) => getRowKey(record, index, rowKey)),
292
- [rowKey, visibleRecords]
293
- );
294
- const selectedKeySignature = selectedKeys.map(String).join("|");
295
- const visibleKeySignature = visibleSelectionKeys.map(String).join("|");
296
- useEffect(() => {
297
- var _a2;
298
- if (!rowSelection || preserveSelectedRowKeys || selectedKeys.length === 0) return;
299
- const visibleKeySet = new Set(visibleSelectionKeys);
300
- const nextSelectedKeys = selectedKeys.filter((key) => visibleKeySet.has(key));
301
- if (nextSelectedKeys.length === selectedKeys.length) return;
302
- if (rowSelection.selectedRowKeys === void 0) {
303
- setUncontrolledSelectedKeys(nextSelectedKeys);
304
- }
305
- const nextSelectedKeySet = new Set(nextSelectedKeys);
306
- const nextSelectedRows = visibleRecords.filter(({ record, index }) => nextSelectedKeySet.has(getRowKey(record, index, rowKey))).map(({ record }) => record);
307
- (_a2 = rowSelection.onChange) == null ? void 0 : _a2.call(rowSelection, nextSelectedKeys, nextSelectedRows, { type: "multiple" });
308
- }, [preserveSelectedRowKeys, rowSelection, rowKey, selectedKeySignature, visibleKeySignature, visibleRecords]);
309
- useEffect(() => {
310
- const element = tableScrollRef.current;
311
- if (!element || !(scroll == null ? void 0 : scroll.x)) {
312
- setHorizontalInsets((previous) => previous.start === 0 && previous.end === 0 ? previous : { start: 0, end: 0 });
313
- setScrollPing((previous) => previous.start || previous.end ? { start: false, end: false } : previous);
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);
314
226
  return;
315
227
  }
316
- const measure = () => {
317
- const layoutRow = element.querySelector(".bj-table__header .bj-table__header-row") ?? element.querySelector(".bj-table__body .bj-table__row");
318
- let start = 0;
319
- let end = 0;
320
- if (layoutRow) {
321
- Array.from(layoutRow.children).forEach((cell) => {
322
- const width = cell.getBoundingClientRect().width;
323
- if (cell.classList.contains("bj-table__cell--fixed-right")) {
324
- end += width;
325
- } else if (cell.classList.contains("bj-table__cell--fixed-left") || cell.classList.contains("bj-table__selection-cell--fixed")) {
326
- start += width;
327
- }
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);
328
235
  });
329
- const borderWidth = element.clientLeft;
330
- if (start > 0) start += borderWidth;
331
- if (end > 0) end = Math.max(end - borderWidth, 0);
236
+ const o = e.clientLeft;
237
+ i > 0 && (i += o), _ > 0 && (_ = Math.max(_ - o, 0));
332
238
  }
333
- setHorizontalInsets((previous) => previous.start === start && previous.end === end ? previous : { start, end });
334
- };
335
- const syncPing = () => {
336
- const maxScroll = element.scrollWidth - element.clientWidth;
337
- const scrollable = maxScroll > SCROLL_EDGE_THRESHOLD;
338
- const next = {
339
- start: scrollable && element.scrollLeft > SCROLL_EDGE_THRESHOLD,
340
- end: scrollable && element.scrollLeft < maxScroll - SCROLL_EDGE_THRESHOLD
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
341
244
  };
342
- setScrollPing((previous) => previous.start === next.start && previous.end === next.end ? previous : next);
343
- };
344
- const sync = () => {
345
- measure();
346
- syncPing();
245
+ Ye((o) => o.start === _.start && o.end === _.end ? o : _);
246
+ }, s = () => {
247
+ t(), r();
347
248
  };
348
- sync();
349
- element.addEventListener("scroll", syncPing, { passive: true });
350
- const observer = new ResizeObserver(sync);
351
- observer.observe(element);
352
- if (element.firstElementChild) observer.observe(element.firstElementChild);
353
- return () => {
354
- element.removeEventListener("scroll", syncPing);
355
- observer.disconnect();
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();
356
253
  };
357
- }, [fixedLayoutSignature, scroll == null ? void 0 : scroll.x, showHeader, visibleRecords.length]);
358
- const emitChange = (action, nextSortOrders = sortOrders, nextFilters = activeFilters, nextCurrent = current, nextPageSize = pageSize) => {
359
- const filterInfo = Object.fromEntries(nextFilters);
360
- const nextFilteredData = filterRecords(dataSource, activeColumns, nextFilters);
361
- const nextProcessedData = sortRecords(nextFilteredData, activeColumns, nextSortOrders);
362
- onChange == null ? void 0 : onChange(
363
- { ...paginationConfig, current: nextCurrent, pageSize: nextPageSize, total: (paginationConfig == null ? void 0 : paginationConfig.total) ?? nextProcessedData.length },
364
- filterInfo,
365
- getSorterResult(activeColumns, nextSortOrders),
366
- { action, currentDataSource: nextProcessedData }
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: _ }
367
262
  );
368
- };
369
- const changeSorter = (column, index) => {
370
- if (!column.sorter) return;
371
- const key = getColumnKey(column, index);
372
- const nextOrder = getNextSortOrder(sortOrders.get(key) ?? null, column.sortDirections ?? sortDirections);
373
- const nextOrders = /* @__PURE__ */ new Map();
374
- nextOrders.set(key, nextOrder);
375
- if (column.sortOrder === void 0) setUncontrolledSortOrders(nextOrders);
376
- emitChange("sort", nextOrders);
377
- };
378
- const confirmFilter = (column, index, selectedKeys2) => {
379
- const key = getColumnKey(column, index);
380
- const nextFilters = new Map(activeFilters);
381
- nextFilters.set(key, selectedKeys2);
382
- if (column.filteredValue === void 0) setUncontrolledFilters(nextFilters);
383
- setOpenFilterKey(null);
384
- if ((paginationConfig == null ? void 0 : paginationConfig.current) === void 0) setUncontrolledCurrent(1);
385
- emitChange("filter", sortOrders, nextFilters, 1);
386
- };
387
- const resetFilter = (column, index) => {
388
- const key = getColumnKey(column, index);
389
- const nextKeys = column.filterResetToDefaultFilteredValue ? column.defaultFilteredValue ?? [] : [];
390
- setDraftFilters((filters) => new Map(filters).set(key, nextKeys));
391
- };
392
- const toggleFilter = (column, index, anchor) => {
393
- var _a2, _b2, _c2, _d;
394
- const key = getColumnKey(column, index);
395
- if (openFilterKey === key) {
396
- setOpenFilterKey(null);
397
- setFilterAnchor(null);
398
- (_a2 = column.onFilterDropdownOpenChange) == null ? void 0 : _a2.call(column, false);
399
- (_b2 = column.onFilterDropdownVisibleChange) == null ? void 0 : _b2.call(column, false);
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);
400
278
  return;
401
279
  }
402
- setFilterSearchInput("");
403
- setDebouncedFilterSearch("");
404
- setRequestedFilterOptions(void 0);
405
- setDraftFilters((filters) => new Map(filters).set(key, activeFilters.get(key) ?? []));
406
- setOpenFilterKey(key);
407
- if (anchor) setFilterAnchor(anchor);
408
- (_c2 = column.onFilterDropdownOpenChange) == null ? void 0 : _c2.call(column, true);
409
- (_d = column.onFilterDropdownVisibleChange) == null ? void 0 : _d.call(column, true);
410
- };
411
- const renderHeaderCell = (column, index) => {
412
- var _a2, _b2;
413
- const key = getColumnKey(column, index);
414
- const badgeId = `bj-table-badge-${tableInstanceId}-${String(key).replace(/[^a-zA-Z0-9_-]/g, "-")}`;
415
- const sortOrder = sortOrders.get(key) ?? null;
416
- const filteredKeys = activeFilters.get(key) ?? [];
417
- const draftKeys = draftFilters.get(key) ?? filteredKeys;
418
- const isFilterOpen = column.filterDropdownOpen ?? column.filterDropdownVisible ?? openFilterKey === key;
419
- const isFiltered = column.filtered || filteredKeys.length > 0;
420
- const sortIconType = sortOrder === "ascend" ? "icon-a-zhengxumian" : sortOrder === "descend" ? "icon-a-daoxumian" : "icon-a-weipaixumian";
421
- const title2 = renderColumnTitle(column.title, {
422
- sortOrder,
423
- sortColumn: sortOrder ? column : void 0,
424
- sortColumns: sortOrder ? [{ column, order: sortOrder }] : [],
425
- filters: Object.fromEntries(activeFilters)
426
- });
427
- const customFilterContent = typeof column.filterDropdown === "function" ? column.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({
428
289
  prefixCls: "bj-table",
429
- selectedKeys: draftKeys.filter((value) => typeof value !== "boolean"),
430
- setSelectedKeys: (keys) => setDraftFilters((filters) => new Map(filters).set(key, keys)),
431
- confirm: (options) => {
432
- confirmFilter(column, index, draftFilters.get(key) ?? draftKeys);
433
- if ((options == null ? void 0 : options.closeDropdown) === false) setOpenFilterKey(key);
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);
434
294
  },
435
- clearFilters: (options) => {
436
- const nextKeys = column.filterResetToDefaultFilteredValue ? column.defaultFilteredValue ?? [] : [];
437
- setDraftFilters((filters) => new Map(filters).set(key, nextKeys));
438
- if ((options == null ? void 0 : options.confirm) === true) confirmFilter(column, index, nextKeys);
439
- if ((options == null ? void 0 : options.closeDropdown) === false || (options == null ? void 0 : options.confirm) !== true) setOpenFilterKey(key);
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);
440
298
  },
441
- filters: column.filters,
442
- close: () => setOpenFilterKey(null),
443
- visible: isFilterOpen
444
- }) : column.filterDropdown;
445
- const filterOptions = column.filterRequest ? requestedFilterOptions ?? [] : column.filters ?? [];
446
- const visibleFilterOptions = debouncedFilterSearch && !column.filterRequest ? filterOptions.filter((option) => typeof column.filterSearch === "function" ? column.filterSearch(debouncedFilterSearch, option) : defaultFilterSearch(debouncedFilterSearch, option)) : filterOptions;
447
- const showFilterSearch = Boolean(column.filterSearch || column.filterRequest);
448
- const headerContent = /* @__PURE__ */ jsxs("div", { className: classNames("bj-table__column-header", column.sorter && "bj-table__column-header--sortable"), children: [
449
- column.badge !== void 0 && /* @__PURE__ */ jsx(
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(
450
304
  "span",
451
305
  {
452
306
  "aria-label": "表头提示",
453
307
  className: "bj-table__column-badge-trigger",
454
- id: badgeId,
455
- onBlur: () => setHoveredBadgeKey(null),
456
- onClick: (event) => event.stopPropagation(),
457
- onFocus: () => setHoveredBadgeKey(key),
458
- onKeyDown: (event) => event.stopPropagation(),
459
- onMouseEnter: () => setHoveredBadgeKey(key),
460
- onMouseLeave: () => setHoveredBadgeKey(null),
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),
461
315
  role: "button",
462
316
  tabIndex: 0,
463
- children: /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: "bj-table__column-badge-shape" })
317
+ children: /* @__PURE__ */ b("span", { "aria-hidden": "true", className: "bj-table__column-badge-shape" })
464
318
  }
465
319
  ),
466
- /* @__PURE__ */ jsxs("div", { className: "bj-table__column-title", children: [
467
- /* @__PURE__ */ jsx("span", { className: "bj-table__column-title-content", children: title2 }),
468
- column.sorter && /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: "bj-table__column-sorter", children: /* @__PURE__ */ jsx(BuIcon, { className: "bj-table__column-sorter-icon", type: sortIconType }) })
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 }) })
469
323
  ] }),
470
- (column.filters || column.filterDropdown) && /* @__PURE__ */ jsxs("div", { className: "bj-table__filter", children: [
471
- /* @__PURE__ */ jsx(
324
+ (e.filters || e.filterDropdown) && /* @__PURE__ */ E("div", { className: "bj-table__filter", children: [
325
+ /* @__PURE__ */ b(
472
326
  "button",
473
327
  {
474
- "aria-expanded": isFilterOpen,
328
+ "aria-expanded": _,
475
329
  "aria-label": "筛选",
476
- className: classNames("bj-table__filter-trigger", isFiltered && "bj-table__filter-trigger--active"),
477
- onClick: (event) => {
478
- event.stopPropagation();
479
- toggleFilter(column, index);
330
+ className: L("bj-table__filter-trigger", o && "bj-table__filter-trigger--active"),
331
+ onClick: (c) => {
332
+ c.stopPropagation(), ue(e, t);
480
333
  },
481
334
  type: "button",
482
- children: typeof column.filterIcon === "function" ? column.filterIcon(isFiltered) : column.filterIcon ?? /* @__PURE__ */ jsx(
483
- BuIcon,
335
+ children: typeof e.filterIcon == "function" ? e.filterIcon(o) : e.filterIcon ?? /* @__PURE__ */ b(
336
+ Le,
484
337
  {
485
338
  className: "bj-table__filter-icon",
486
- type: isFiltered ? "icon-shaixuan-daidian" : "icon-a-shaixuanxi"
339
+ type: o ? "icon-shaixuan-daidian" : "icon-a-shaixuanxi"
487
340
  }
488
341
  )
489
342
  }
490
343
  ),
491
- isFilterOpen && filterPopupPosition && typeof document !== "undefined" && createPortal(
492
- /* @__PURE__ */ jsx(
344
+ _ && Ee && typeof document < "u" && nr(
345
+ /* @__PURE__ */ b(
493
346
  "div",
494
347
  {
495
348
  className: "bj-table__filter-dropdown",
496
- onClick: (event) => event.stopPropagation(),
349
+ onClick: (c) => c.stopPropagation(),
497
350
  role: "dialog",
498
- style: { left: filterPopupPosition.left, top: filterPopupPosition.top },
499
- children: customFilterContent ?? /* @__PURE__ */ jsx(
500
- BDropdown,
351
+ style: { left: Ee.left, top: Ee.top },
352
+ children: Z ?? /* @__PURE__ */ b(
353
+ cr,
501
354
  {
502
- ...column.filterDropdownProps,
503
- emptyText: (locale == null ? void 0 : locale.filterEmptyText) ?? t("暂无结果"),
504
- multiple: column.filterMultiple !== false,
505
- onChange: (nextKeys, option) => {
506
- var _a3, _b3;
507
- setDraftFilters((filters) => new Map(filters).set(key, nextKeys));
508
- (_b3 = (_a3 = column.filterDropdownProps) == null ? void 0 : _a3.onChange) == null ? void 0 : _b3.call(_a3, nextKeys, option);
355
+ ...e.filterDropdownProps,
356
+ emptyText: (ee == null ? void 0 : ee.filterEmptyText) ?? C("暂无结果"),
357
+ multiple: e.filterMultiple !== !1,
358
+ onChange: (c, x) => {
359
+ var k, ut;
360
+ ie((ir) => new Map(ir).set(r, c)), (ut = (k = e.filterDropdownProps) == null ? void 0 : k.onChange) == null || ut.call(k, c, x);
509
361
  },
510
- onConfirm: (nextKeys) => {
511
- var _a3, _b3;
512
- confirmFilter(column, index, nextKeys);
513
- (_b3 = (_a3 = column.filterDropdownProps) == null ? void 0 : _a3.onConfirm) == null ? void 0 : _b3.call(_a3, nextKeys);
362
+ onConfirm: (c) => {
363
+ var x, k;
364
+ Ke(e, t, c), (k = (x = e.filterDropdownProps) == null ? void 0 : x.onConfirm) == null || k.call(x, c);
514
365
  },
515
366
  onReset: () => {
516
- var _a3, _b3;
517
- resetFilter(column, index);
518
- (_b3 = (_a3 = column.filterDropdownProps) == null ? void 0 : _a3.onReset) == null ? void 0 : _b3.call(_a3);
367
+ var c, x;
368
+ $t(e, t), (x = (c = e.filterDropdownProps) == null ? void 0 : c.onReset) == null || x.call(c);
519
369
  },
520
- onSearch: (nextSearchValue) => {
521
- var _a3, _b3;
522
- setFilterSearchInput(nextSearchValue);
523
- (_b3 = (_a3 = column.filterDropdownProps) == null ? void 0 : _a3.onSearch) == null ? void 0 : _b3.call(_a3, nextSearchValue);
370
+ onSearch: (c) => {
371
+ var x, k;
372
+ Ue(c), (k = (x = e.filterDropdownProps) == null ? void 0 : x.onSearch) == null || k.call(x, c);
524
373
  },
525
- options: visibleFilterOptions.map((option) => ({
526
- label: option.text,
527
- description: option.description,
528
- value: option.value
374
+ options: T.map((c) => ({
375
+ label: c.text,
376
+ description: c.description,
377
+ value: c.value
529
378
  })),
530
- searchable: ((_a2 = column.filterDropdownProps) == null ? void 0 : _a2.searchable) ?? showFilterSearch,
531
- searchPlaceholder: ((_b2 = column.filterDropdownProps) == null ? void 0 : _b2.searchPlaceholder) ?? (column.filterRequest ? t("请输入搜索内容") : (locale == null ? void 0 : locale.filterSearchPlaceholder) ?? t("搜索")),
532
- searchValue: filterSearchInput,
533
- t,
534
- value: draftKeys
379
+ searchable: ((F = e.filterDropdownProps) == null ? void 0 : F.searchable) ?? v,
380
+ searchPlaceholder: ((M = e.filterDropdownProps) == null ? void 0 : M.searchPlaceholder) ?? (e.filterRequest ? C("请输入搜索内容") : (ee == null ? void 0 : ee.filterSearchPlaceholder) ?? C("搜索")),
381
+ searchValue: Pe,
382
+ t: C,
383
+ value: i
535
384
  }
536
385
  )
537
386
  }
@@ -540,411 +389,316 @@ function BTable({
540
389
  )
541
390
  ] })
542
391
  ] });
543
- return column.badge !== void 0 ? /* @__PURE__ */ jsxs(
544
- TooltipWrapper,
392
+ return e.badge !== void 0 ? /* @__PURE__ */ E(
393
+ dr,
545
394
  {
546
395
  className: "bj-table__column-tooltip-wrapper",
547
396
  children: [
548
- /* @__PURE__ */ jsx("div", { className: "bj-table__column-tooltip-trigger", children: headerContent }),
549
- hoveredBadgeKey === key && /* @__PURE__ */ jsx(
550
- BTooltip,
397
+ /* @__PURE__ */ b("div", { className: "bj-table__column-tooltip-trigger", children: z }),
398
+ Lt === r && /* @__PURE__ */ b(
399
+ lr,
551
400
  {
552
401
  className: "bj-table__column-tooltip",
553
- content: column.badge,
554
- getAnchorElement: () => document.getElementById(badgeId),
402
+ content: e.badge,
403
+ getAnchorElement: () => document.getElementById(s),
555
404
  getPopupContainer: () => document.body,
556
405
  placement: "top"
557
406
  }
558
407
  )
559
408
  ]
560
409
  }
561
- ) : headerContent;
562
- };
563
- const updateSelection = (nextSelectedKeys, selection, selectedRecord) => {
564
- var _a2, _b2;
565
- if (selection.selectedRowKeys === void 0) {
566
- setUncontrolledSelectedKeys(nextSelectedKeys);
567
- }
568
- const selectedKeySet = new Set(nextSelectedKeys);
569
- const selectedRows = dataSource.filter(
570
- (record, index) => selectedKeySet.has(getRowKey(record, index, rowKey))
410
+ ) : z;
411
+ }, at = (e, t, r) => {
412
+ var a, i;
413
+ t.selectedRowKeys === void 0 && We(e);
414
+ const s = new Set(e), l = j.filter(
415
+ (_, o) => s.has(q(_, o, g))
571
416
  );
572
- (_a2 = selection.onChange) == null ? void 0 : _a2.call(selection, nextSelectedKeys, selectedRows);
573
- if (selectedRecord) {
574
- (_b2 = selection.onSelect) == null ? void 0 : _b2.call(
575
- selection,
576
- selectedRecord,
577
- selectedKeySet.has(getRowKey(selectedRecord, dataSource.indexOf(selectedRecord), rowKey)),
578
- selectedRows
579
- );
580
- }
581
- };
582
- const toggleRow = (record, index) => {
583
- if (!rowSelection) {
417
+ (a = t.onChange) == null || a.call(t, e, l), r && ((i = t.onSelect) == null || i.call(
418
+ t,
419
+ r,
420
+ s.has(q(r, j.indexOf(r), g)),
421
+ l
422
+ ));
423
+ }, Ut = (e, t) => {
424
+ if (!d)
584
425
  return;
426
+ const r = q(e, t, g), s = B.includes(r), l = d.type === "radio" ? s ? [] : [r] : s ? B.filter((a) => a !== r) : [...B, r];
427
+ at(l, d, e);
428
+ }, nt = V.filter(
429
+ ({ record: e }) => {
430
+ var t;
431
+ return !((t = d == null ? void 0 : d.getCheckboxProps) != null && t.call(d, e).disabled);
585
432
  }
586
- const key = getRowKey(record, index, rowKey);
587
- const selected = selectedKeys.includes(key);
588
- const nextSelectedKeys = rowSelection.type === "radio" ? selected ? [] : [key] : selected ? selectedKeys.filter((selectedKey) => selectedKey !== key) : [...selectedKeys, key];
589
- updateSelection(nextSelectedKeys, rowSelection, record);
590
- };
591
- const selectableVisibleRecords = visibleRecords.filter(
592
- ({ record }) => {
593
- var _a2;
594
- return !((_a2 = rowSelection == null ? void 0 : rowSelection.getCheckboxProps) == null ? void 0 : _a2.call(rowSelection, record).disabled);
595
- }
596
- );
597
- const selectableVisibleKeys = selectableVisibleRecords.map(
598
- ({ record, index }) => getRowKey(record, index, rowKey)
599
- );
600
- const allVisibleSelected = selectableVisibleKeys.length > 0 && selectableVisibleKeys.every((key) => selectedKeys.includes(key));
601
- const toggleAll = () => {
602
- var _a2;
603
- if (!rowSelection || rowSelection.type === "radio") {
433
+ ), se = nt.map(
434
+ ({ record: e, index: t }) => q(e, t, g)
435
+ ), Se = se.length > 0 && se.every((e) => B.includes(e)), Jt = () => {
436
+ var r;
437
+ if (!d || d.type === "radio")
604
438
  return;
605
- }
606
- const visibleKeySet = new Set(selectableVisibleKeys);
607
- const nextSelectedKeys = allVisibleSelected ? selectedKeys.filter((key) => !visibleKeySet.has(key)) : Array.from(/* @__PURE__ */ new Set([...selectedKeys, ...selectableVisibleKeys]));
608
- updateSelection(nextSelectedKeys, rowSelection);
609
- new Set(nextSelectedKeys);
610
- (_a2 = rowSelection.onSelectAll) == null ? void 0 : _a2.call(
611
- rowSelection,
612
- !allVisibleSelected,
613
- selectableVisibleRecords.map(({ record }) => record)
439
+ const e = new Set(se), t = Se ? B.filter((s) => !e.has(s)) : Array.from(/* @__PURE__ */ new Set([...B, ...se]));
440
+ at(t, d), new Set(t), (r = d.onSelectAll) == null || r.call(
441
+ d,
442
+ !Se,
443
+ nt.map(({ record: s }) => s)
614
444
  );
615
- };
616
- const changePage = (nextPage) => {
617
- var _a2;
618
- if (!paginationConfig || nextPage < 1 || nextPage > pageCount || nextPage === current) {
445
+ }, Qt = (e) => {
446
+ var t;
447
+ !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));
448
+ }, Zt = (e) => {
449
+ var r, s;
450
+ if (!n || e === W)
619
451
  return;
620
- }
621
- if (paginationConfig.current === void 0) {
622
- setUncontrolledCurrent(nextPage);
623
- }
624
- (_a2 = paginationConfig.onChange) == null ? void 0 : _a2.call(paginationConfig, nextPage, pageSize);
625
- emitChange("paginate", sortOrders, activeFilters, nextPage);
626
- };
627
- const changePageSize = (nextPageSize) => {
628
- var _a2, _b2;
629
- if (!paginationConfig || nextPageSize === pageSize) {
630
- return;
631
- }
632
- const nextCurrent = 1;
633
- ignoreNextPaginationChangeRef.current = true;
634
- if (paginationConfig.pageSize === void 0) {
635
- setUncontrolledPageSize(nextPageSize);
636
- }
637
- if (paginationConfig.current === void 0) {
638
- setUncontrolledCurrent(nextCurrent);
639
- }
640
- (_a2 = paginationConfig.onShowSizeChange) == null ? void 0 : _a2.call(paginationConfig, nextCurrent, nextPageSize);
641
- (_b2 = paginationConfig.onChange) == null ? void 0 : _b2.call(paginationConfig, nextCurrent, nextPageSize);
642
- emitChange("paginate", sortOrders, activeFilters, nextCurrent, nextPageSize);
643
- };
644
- const columnCount = activeColumns.length + (rowSelection ? 1 : 0);
645
- const selectionColumnWidth = (rowSelection == null ? void 0 : rowSelection.columnWidth) ?? 48;
646
- const getColumnWidth = (column) => typeof column.width === "number" ? column.width : 0;
647
- const getFixedStyle = (column, columnIndex) => {
648
- const fixed = column.fixed === true ? "left" : column.fixed;
649
- if (fixed === "left") {
650
- const left = activeColumns.slice(0, columnIndex).reduce((offset, current2) => offset + getColumnWidth(current2), rowSelection && typeof selectionColumnWidth === "number" ? selectionColumnWidth : 0);
651
- return { position: "sticky", left, zIndex: 2 };
652
- }
653
- if (fixed === "right") {
654
- const right = activeColumns.slice(columnIndex + 1).reduce((offset, current2) => offset + getColumnWidth(current2), 0);
655
- return { position: "sticky", right, zIndex: 2 };
656
- }
657
- return {};
658
- };
659
- const scrollTableStyle = (scroll == null ? void 0 : scroll.x) ? {
660
- width: scroll.x === true ? "max-content" : scroll.x,
452
+ const t = 1;
453
+ 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);
454
+ }, 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) => {
455
+ const r = e.fixed === !0 ? "left" : e.fixed;
456
+ 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 } : {};
457
+ }, Xt = f != null && f.x ? {
458
+ width: f.x === !0 ? "max-content" : f.x,
661
459
  minWidth: "100%",
662
- tableLayout: tableLayout ?? "fixed"
663
- } : { tableLayout };
664
- const TableComponent = (components == null ? void 0 : components.table) ?? "table";
665
- const HeaderWrapper = ((_a = components == null ? void 0 : components.header) == null ? void 0 : _a.wrapper) ?? "thead";
666
- const HeaderRow = ((_b = components == null ? void 0 : components.header) == null ? void 0 : _b.row) ?? "tr";
667
- const HeaderCell = ((_c = components == null ? void 0 : components.header) == null ? void 0 : _c.cell) ?? "th";
668
- const bodyComponents = typeof (components == null ? void 0 : components.body) === "object" ? components.body : void 0;
669
- const BodyWrapper = (bodyComponents == null ? void 0 : bodyComponents.wrapper) ?? "tbody";
670
- const BodyRow = (bodyComponents == null ? void 0 : bodyComponents.row) ?? "tr";
671
- const BodyCell = (bodyComponents == null ? void 0 : bodyComponents.cell) ?? "td";
672
- const resolvedEmptyText = typeof emptyText === "function" ? emptyText() : emptyText ?? t("暂无数据");
673
- const resolvedEmptyImage = typeof emptyImage === "string" ? /* @__PURE__ */ jsx("img", { alt: "", className: "bj-table__empty-image", src: emptyImage }) : emptyImage;
674
- return /* @__PURE__ */ jsxs(
460
+ tableLayout: ve ?? "fixed"
461
+ } : { 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;
462
+ return /* @__PURE__ */ E(
675
463
  "div",
676
464
  {
677
- id,
678
- ref: tableRootRef,
679
- className: classNames(
465
+ id: Et,
466
+ ref: fe,
467
+ className: L(
680
468
  "bj-table",
681
- bordered && "bj-table--bordered",
682
- `bj-table--${size}`,
683
- loading && "bj-table--loading",
684
- processedData.length === 0 && "bj-table--empty",
685
- scrollPing.start && "bj-table--ping-left",
686
- scrollPing.end && "bj-table--ping-right",
687
- className
469
+ vt && "bj-table--bordered",
470
+ `bj-table--${xt}`,
471
+ ye && "bj-table--loading",
472
+ S.length === 0 && "bj-table--empty",
473
+ Xe.start && "bj-table--ping-left",
474
+ Xe.end && "bj-table--ping-right",
475
+ Rt
688
476
  ),
689
- style,
477
+ style: Ft,
690
478
  children: [
691
- title && /* @__PURE__ */ jsx("div", { className: "bj-table__title", children: title(processedData) }),
692
- /* @__PURE__ */ jsxs("div", { className: "bj-table__viewport", children: [
693
- /* @__PURE__ */ jsx(
479
+ we && /* @__PURE__ */ b("div", { className: "bj-table__title", children: we(S) }),
480
+ /* @__PURE__ */ E("div", { className: "bj-table__viewport", children: [
481
+ /* @__PURE__ */ b(
694
482
  "div",
695
483
  {
696
- className: classNames("bj-table__scroll", Boolean((scroll == null ? void 0 : scroll.x) || (scroll == null ? void 0 : scroll.y)) && "bj-overlay-scrollbar-hidden"),
697
- ref: tableScrollRef,
698
- style: { maxHeight: scroll == null ? void 0 : scroll.y },
699
- children: /* @__PURE__ */ jsxs(TableComponent, { className: "bj-table__native-table", style: scrollTableStyle, children: [
700
- activeColumns.some((column) => column.width) && /* @__PURE__ */ jsxs("colgroup", { children: [
701
- rowSelection && /* @__PURE__ */ jsx("col", { className: "bj-table__selection-col", style: { width: selectionColumnWidth } }),
702
- activeColumns.map((column, index) => /* @__PURE__ */ jsx("col", { style: { width: column.width } }, column.key ?? index))
484
+ className: L("bj-table__scroll", !!(f != null && f.x || f != null && f.y) && "bj-overlay-scrollbar-hidden"),
485
+ ref: Re,
486
+ style: { maxHeight: f == null ? void 0 : f.y },
487
+ children: /* @__PURE__ */ E(Yt, { className: "bj-table__native-table", style: Xt, children: [
488
+ y.some((e) => e.width) && /* @__PURE__ */ E("colgroup", { children: [
489
+ d && /* @__PURE__ */ b("col", { className: "bj-table__selection-col", style: { width: le } }),
490
+ y.map((e, t) => /* @__PURE__ */ b("col", { style: { width: e.width } }, e.key ?? t))
703
491
  ] }),
704
- showHeader && /* @__PURE__ */ jsx(HeaderWrapper, { className: "bj-table__header", children: headerRows.map((headerRow, rowIndex) => /* @__PURE__ */ jsxs(HeaderRow, { className: "bj-table__header-row", ...onHeaderRow == null ? void 0 : onHeaderRow(activeColumns, rowIndex), children: [
705
- rowSelection && rowIndex === 0 && /* @__PURE__ */ jsxs(
706
- HeaderCell,
492
+ 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: [
493
+ d && t === 0 && /* @__PURE__ */ E(
494
+ ft,
707
495
  {
708
- className: classNames(
496
+ className: L(
709
497
  "bj-table__header-cell",
710
498
  "bj-table__selection-cell",
711
- Boolean(scroll == null ? void 0 : scroll.x) && "bj-table__selection-cell--fixed",
499
+ !!(f != null && f.x) && "bj-table__selection-cell--fixed",
712
500
  // 选择列就是最后一个左固定区域时,由它承担左侧渐变阴影
713
- Boolean(scroll == null ? void 0 : scroll.x) && !isFixedLeftColumn(activeColumns[0]) && "bj-table__cell--fixed-left-last"
501
+ !!(f != null && f.x) && !$(y[0]) && "bj-table__cell--fixed-left-last"
714
502
  ),
715
- rowSpan: headerRows.length,
503
+ rowSpan: Ae.length,
716
504
  scope: "col",
717
- style: { width: selectionColumnWidth },
505
+ style: { width: le },
718
506
  children: [
719
- rowSelection.type !== "radio" && /* @__PURE__ */ jsx(
720
- SelectionControl,
507
+ d.type !== "radio" && /* @__PURE__ */ b(
508
+ gt,
721
509
  {
722
- checked: allVisibleSelected,
723
- disabled: selectableVisibleKeys.length === 0,
724
- onChange: toggleAll,
510
+ checked: Se,
511
+ disabled: se.length === 0,
512
+ onChange: Jt,
725
513
  label: "选择当前页所有行"
726
514
  }
727
515
  ),
728
- rowSelection.columnTitle
516
+ d.columnTitle
729
517
  ]
730
518
  }
731
519
  ),
732
- headerRow.map(({ column: rawColumn, colSpan, rowSpan }, index) => {
733
- var _a2, _b2;
734
- const column = rawColumn;
735
- const leafIndex = activeColumns.indexOf(column);
736
- const interactionIndex = leafIndex >= 0 ? leafIndex : index;
737
- const isFilterable = !("children" in rawColumn) && Boolean(column.filters || column.filterDropdown);
738
- const isSortable = !("children" in rawColumn) && Boolean(column.sorter);
739
- const triggerHeaderAction = () => {
740
- if (isFilterable) {
741
- toggleFilter(column, interactionIndex);
742
- } else if (isSortable) {
743
- changeSorter(column, interactionIndex);
744
- }
520
+ e.map(({ column: r, colSpan: s, rowSpan: l }, a) => {
521
+ var G, T;
522
+ const i = r, _ = y.indexOf(i), o = _ >= 0 ? _ : a, p = !("children" in r) && !!(i.filters || i.filterDropdown), u = !("children" in r) && !!i.sorter, Z = () => {
523
+ p ? ue(i, o) : u && Wt(i, o);
745
524
  };
746
- return /* @__PURE__ */ createElement(
747
- HeaderCell,
525
+ return /* @__PURE__ */ Me(
526
+ ft,
748
527
  {
749
- ...(_a2 = column.onHeaderCell) == null ? void 0 : _a2.call(column, rawColumn, index),
750
- "aria-label": typeof column.title === "string" ? column.title : void 0,
751
- "aria-sort": isSortable ? sortOrders.get(getColumnKey(column, interactionIndex)) === "ascend" ? "ascending" : sortOrders.get(getColumnKey(column, interactionIndex)) === "descend" ? "descending" : "none" : void 0,
752
- className: classNames(
528
+ ...(G = i.onHeaderCell) == null ? void 0 : G.call(i, r, a),
529
+ "aria-label": typeof i.title == "string" ? i.title : void 0,
530
+ "aria-sort": u ? P.get(O(i, o)) === "ascend" ? "ascending" : P.get(O(i, o)) === "descend" ? "descending" : "none" : void 0,
531
+ className: L(
753
532
  "bj-table__header-cell",
754
- ((_b2 = activeColumns[interactionIndex + 1]) == null ? void 0 : _b2.fixed) === "right" && "bj-table__cell--before-fixed-right",
755
- column.fixed && "bj-table__cell--fixed",
756
- isFixedLeftColumn(column) && "bj-table__cell--fixed-left",
757
- isFixedLeftColumn(column) && !isFixedLeftColumn(activeColumns[interactionIndex + 1]) && "bj-table__cell--fixed-left-last",
758
- isFixedRightColumn(column) && "bj-table__cell--fixed-right",
759
- isFixedRightColumn(column) && !isFixedRightColumn(activeColumns[interactionIndex - 1]) && "bj-table__cell--fixed-right-first",
760
- column.sorter && "bj-table__header-cell--sortable",
761
- isFilterable && "bj-table__header-cell--filterable",
762
- sortOrders.get(getColumnKey(column, interactionIndex)) && "bj-table__header-cell--sorted",
763
- column.className
533
+ ((T = y[o + 1]) == null ? void 0 : T.fixed) === "right" && "bj-table__cell--before-fixed-right",
534
+ i.fixed && "bj-table__cell--fixed",
535
+ $(i) && "bj-table__cell--fixed-left",
536
+ $(i) && !$(y[o + 1]) && "bj-table__cell--fixed-left-last",
537
+ te(i) && "bj-table__cell--fixed-right",
538
+ te(i) && !te(y[o - 1]) && "bj-table__cell--fixed-right-first",
539
+ i.sorter && "bj-table__header-cell--sortable",
540
+ p && "bj-table__header-cell--filterable",
541
+ P.get(O(i, o)) && "bj-table__header-cell--sorted",
542
+ i.className
764
543
  ),
765
- colSpan,
766
- key: column.key ?? String(column.dataIndex ?? index),
767
- onClick: (event) => {
768
- var _a3, _b3, _c2;
769
- (_c2 = (_b3 = (_a3 = column.onHeaderCell) == null ? void 0 : _a3.call(column, rawColumn, index)) == null ? void 0 : _b3.onClick) == null ? void 0 : _c2.call(_b3, event);
770
- if (event.target.closest(".bj-table__filter-dropdown")) return;
771
- if (isFilterable) {
772
- toggleFilter(column, interactionIndex, event.currentTarget);
773
- } else {
774
- triggerHeaderAction();
775
- }
544
+ colSpan: s,
545
+ key: i.key ?? String(i.dataIndex ?? a),
546
+ onClick: (v) => {
547
+ var z, F, M;
548
+ (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());
776
549
  },
777
- onKeyDown: (event) => {
778
- var _a3, _b3, _c2;
779
- (_c2 = (_b3 = (_a3 = column.onHeaderCell) == null ? void 0 : _a3.call(column, rawColumn, index)) == null ? void 0 : _b3.onKeyDown) == null ? void 0 : _c2.call(_b3, event);
780
- if (event.target.closest(".bj-table__filter-dropdown")) return;
781
- if (event.key === "Enter" || event.key === " ") {
782
- event.preventDefault();
783
- if (isFilterable) {
784
- toggleFilter(column, interactionIndex, event.currentTarget);
785
- } else {
786
- triggerHeaderAction();
787
- }
788
- }
550
+ onKeyDown: (v) => {
551
+ var z, F, M;
552
+ (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());
789
553
  },
790
- rowSpan,
554
+ rowSpan: l,
791
555
  scope: "col",
792
- style: { textAlign: column.align, ...getFixedStyle(column, interactionIndex) },
793
- tabIndex: isFilterable || isSortable ? 0 : void 0
556
+ style: { textAlign: i.align, ...dt(i, o) },
557
+ tabIndex: p || u ? 0 : void 0
794
558
  },
795
- "children" in rawColumn ? renderColumnTitle(rawColumn.title, { filters: Object.fromEntries(activeFilters) }) : renderHeaderCell(column, interactionIndex)
559
+ "children" in r ? mt(r.title, { filters: Object.fromEntries(K) }) : Ht(i, o)
796
560
  );
797
561
  })
798
- ] }, rowIndex)) }),
799
- /* @__PURE__ */ jsx(BodyWrapper, { className: "bj-table__body", children: visibleRecords.length > 0 ? visibleRecords.map(({ record, index }) => {
800
- var _a2;
801
- const key = getRowKey(record, index, rowKey);
802
- const groupRow = isGroupRow(record, index);
803
- const isDisabled = ((_a2 = rowSelection == null ? void 0 : rowSelection.getCheckboxProps) == null ? void 0 : _a2.call(rowSelection, record).disabled) ?? false;
804
- const isSelected = selectedKeys.includes(key);
805
- const resolvedRowClassName = typeof rowClassName === "function" ? rowClassName(record, index, 0) : rowClassName;
806
- return /* @__PURE__ */ createElement(
807
- BodyRow,
562
+ ] }, t)) }),
563
+ /* @__PURE__ */ b(tr, { className: "bj-table__body", children: V.length > 0 ? V.map(({ record: e, index: t }) => {
564
+ var _;
565
+ 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;
566
+ return /* @__PURE__ */ Me(
567
+ ct,
808
568
  {
809
- ...onRow == null ? void 0 : onRow(record, index),
810
- className: classNames("bj-table__row", groupRow && "bj-table__row--group", isSelected && "bj-table__row--selected", resolvedRowClassName),
811
- key
569
+ ...xe == null ? void 0 : xe(e, t),
570
+ className: L("bj-table__row", s && "bj-table__row--group", a && "bj-table__row--selected", i),
571
+ key: r
812
572
  },
813
- rowSelection && !groupRow && /* @__PURE__ */ jsx(
814
- BodyCell,
573
+ d && !s && /* @__PURE__ */ b(
574
+ ze,
815
575
  {
816
- className: classNames(
576
+ className: L(
817
577
  "bj-table__cell",
818
578
  "bj-table__selection-cell",
819
- Boolean(scroll == null ? void 0 : scroll.x) && "bj-table__selection-cell--fixed",
579
+ !!(f != null && f.x) && "bj-table__selection-cell--fixed",
820
580
  // 选择列就是最后一个左固定区域时,由它承担左侧渐变阴影
821
- Boolean(scroll == null ? void 0 : scroll.x) && !isFixedLeftColumn(activeColumns[0]) && "bj-table__cell--fixed-left-last"
581
+ !!(f != null && f.x) && !$(y[0]) && "bj-table__cell--fixed-left-last"
822
582
  ),
823
- style: { width: selectionColumnWidth },
824
- children: /* @__PURE__ */ jsx(
825
- SelectionControl,
583
+ style: { width: le },
584
+ children: /* @__PURE__ */ b(
585
+ gt,
826
586
  {
827
- checked: isSelected,
828
- disabled: isDisabled,
829
- label: `选择第 ${index + 1} 行`,
830
- name: rowSelection.type === "radio" ? "bj-table-row-selection" : void 0,
831
- onChange: () => toggleRow(record, index),
832
- type: rowSelection.type ?? "checkbox"
587
+ checked: a,
588
+ disabled: l,
589
+ label: `选择第 ${t + 1} 行`,
590
+ name: d.type === "radio" ? "bj-table-row-selection" : void 0,
591
+ onChange: () => Ut(e, t),
592
+ type: d.type ?? "checkbox"
833
593
  }
834
594
  )
835
595
  }
836
596
  ),
837
- activeColumns.map((rawColumn, columnIndex) => {
838
- var _a3, _b2, _c2;
839
- if (groupRow && columnIndex > 0) return null;
840
- const column = rawColumn;
841
- const value = getValue(record, column.dataIndex);
842
- const rendered = column.render ? column.render(value, record, index) : value;
843
- const renderedCell = isRenderedCell(rendered) ? rendered : void 0;
844
- const cellProps = { ...(_a3 = column.onCell) == null ? void 0 : _a3.call(column, record, index), ...renderedCell == null ? void 0 : renderedCell.props };
845
- const content = renderedCell ? renderedCell.children : rendered;
846
- if (cellProps.colSpan === 0 || cellProps.rowSpan === 0) return null;
847
- return /* @__PURE__ */ createElement(
848
- BodyCell,
597
+ y.map((o, p) => {
598
+ var F, M, c;
599
+ if (s && p > 0) return null;
600
+ 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;
601
+ return v.colSpan === 0 || v.rowSpan === 0 ? null : /* @__PURE__ */ Me(
602
+ ze,
849
603
  {
850
- ...cellProps,
851
- className: classNames(
604
+ ...v,
605
+ className: L(
852
606
  "bj-table__cell",
853
- ((_b2 = activeColumns[columnIndex + 1]) == null ? void 0 : _b2.fixed) === "right" && "bj-table__cell--before-fixed-right",
854
- groupRow && "bj-table__cell--group",
855
- column.fixed && "bj-table__cell--fixed",
856
- isFixedLeftColumn(column) && "bj-table__cell--fixed-left",
857
- isFixedLeftColumn(column) && !isFixedLeftColumn(activeColumns[columnIndex + 1]) && "bj-table__cell--fixed-left-last",
858
- isFixedRightColumn(column) && "bj-table__cell--fixed-right",
859
- isFixedRightColumn(column) && !isFixedRightColumn(activeColumns[columnIndex - 1]) && "bj-table__cell--fixed-right-first",
860
- column.ellipsis && "bj-table__cell--ellipsis",
861
- column.className,
862
- cellProps.className
607
+ ((M = y[p + 1]) == null ? void 0 : M.fixed) === "right" && "bj-table__cell--before-fixed-right",
608
+ s && "bj-table__cell--group",
609
+ u.fixed && "bj-table__cell--fixed",
610
+ $(u) && "bj-table__cell--fixed-left",
611
+ $(u) && !$(y[p + 1]) && "bj-table__cell--fixed-left-last",
612
+ te(u) && "bj-table__cell--fixed-right",
613
+ te(u) && !te(y[p - 1]) && "bj-table__cell--fixed-right-first",
614
+ u.ellipsis && "bj-table__cell--ellipsis",
615
+ u.className,
616
+ v.className
863
617
  ),
864
- key: column.key ?? String(column.dataIndex ?? columnIndex),
865
- colSpan: groupRow ? columnCount : cellProps.colSpan,
866
- style: { textAlign: column.align, ...getFixedStyle(column, columnIndex), ...cellProps.style }
618
+ key: u.key ?? String(u.dataIndex ?? p),
619
+ colSpan: s ? st : v.colSpan,
620
+ style: { textAlign: u.align, ...dt(u, p), ...v.style }
867
621
  },
868
- groupRow ? ((_c2 = groupCollapse == null ? void 0 : groupCollapse.render) == null ? void 0 : _c2.call(groupCollapse, {
869
- record,
870
- expanded: expandedGroupKeys.includes(getGroupKey(record, index)),
871
- onToggle: () => toggleGroup(record, index)
872
- })) ?? content ?? "" : /* @__PURE__ */ jsx("div", { className: "bj-table__cell-content", children: content ?? "" })
622
+ s ? ((c = h == null ? void 0 : h.render) == null ? void 0 : c.call(h, {
623
+ record: e,
624
+ expanded: Q.includes(oe(e, t)),
625
+ onToggle: () => Gt(e, t)
626
+ })) ?? z ?? "" : /* @__PURE__ */ b("div", { className: "bj-table__cell-content", children: z ?? "" })
873
627
  );
874
628
  })
875
629
  );
876
- }) : /* @__PURE__ */ jsx(BodyRow, { className: "bj-table__empty-row", children: /* @__PURE__ */ jsx(
877
- BodyCell,
630
+ }) : /* @__PURE__ */ b(ct, { className: "bj-table__empty-row", children: /* @__PURE__ */ b(
631
+ ze,
878
632
  {
879
633
  className: "bj-table__empty-cell",
880
- colSpan: Math.max(columnCount, 1),
881
- style: { height: emptyHeight }
634
+ colSpan: Math.max(st, 1),
635
+ style: { height: Nt }
882
636
  }
883
637
  ) }) }),
884
- summary && /* @__PURE__ */ jsx("tfoot", { className: "bj-table__summary", children: summary(processedData) })
638
+ qe && /* @__PURE__ */ b("tfoot", { className: "bj-table__summary", children: qe(S) })
885
639
  ] })
886
640
  }
887
641
  ),
888
- visibleRecords.length === 0 && /* @__PURE__ */ jsx("div", { className: "bj-table__empty-overlay", children: /* @__PURE__ */ jsxs("div", { className: "bj-table__empty-content", children: [
889
- resolvedEmptyImage && /* @__PURE__ */ jsx("div", { className: "bj-table__empty-image-wrap", children: resolvedEmptyImage }),
890
- /* @__PURE__ */ jsx("div", { className: "bj-table__empty-text", children: resolvedEmptyText })
642
+ V.length === 0 && /* @__PURE__ */ b("div", { className: "bj-table__empty-overlay", children: /* @__PURE__ */ E("div", { className: "bj-table__empty-content", children: [
643
+ bt && /* @__PURE__ */ b("div", { className: "bj-table__empty-image-wrap", children: bt }),
644
+ /* @__PURE__ */ b("div", { className: "bj-table__empty-text", children: rr })
891
645
  ] }) })
892
646
  ] }),
893
- ((scroll == null ? void 0 : scroll.x) || (scroll == null ? void 0 : scroll.y)) && /* @__PURE__ */ jsx(
894
- BOverlayScrollbar,
647
+ ((f == null ? void 0 : f.x) || (f == null ? void 0 : f.y)) && /* @__PURE__ */ b(
648
+ br,
895
649
  {
896
- containerRef: tableRootRef,
897
- direction: (scroll == null ? void 0 : scroll.x) && (scroll == null ? void 0 : scroll.y) ? "both" : (scroll == null ? void 0 : scroll.x) ? "horizontal" : "vertical",
650
+ containerRef: fe,
651
+ direction: f != null && f.x && (f != null && f.y) ? "both" : f != null && f.x ? "horizontal" : "vertical",
898
652
  gap: 2,
899
- horizontalInsetEnd: horizontalInsets.end,
900
- horizontalInsetStart: horizontalInsets.start,
653
+ horizontalInsetEnd: Qe.end,
654
+ horizontalInsetStart: Qe.start,
901
655
  size: 4,
902
- targetRef: tableScrollRef
656
+ targetRef: Re
903
657
  }
904
658
  ),
905
- footer && /* @__PURE__ */ jsx("div", { className: "bj-table__footer", children: footer(processedData) }),
906
- loading && /* @__PURE__ */ jsxs("div", { "aria-live": "polite", "aria-busy": "true", className: "bj-table__loading", role: "status", children: [
907
- /* @__PURE__ */ jsx("img", { alt: "", className: "bj-table__loading-indicator", src: loadingIndicator }),
908
- /* @__PURE__ */ jsx("span", { className: "bj-table__loading-text", children: "加载中..." })
659
+ Ge && /* @__PURE__ */ b("div", { className: "bj-table__footer", children: Ge(S) }),
660
+ ye && /* @__PURE__ */ E("div", { "aria-live": "polite", "aria-busy": "true", className: "bj-table__loading", role: "status", children: [
661
+ /* @__PURE__ */ b("img", { alt: "", className: "bj-table__loading-indicator", src: hr }),
662
+ /* @__PURE__ */ b("span", { className: "bj-table__loading-text", children: "加载中..." })
909
663
  ] }),
910
- paginationConfig && processedData.length > 0 && /* @__PURE__ */ jsx("div", { className: "bj-table__pagination", children: /* @__PURE__ */ jsx(
911
- Pagination,
664
+ n && S.length > 0 && /* @__PURE__ */ b("div", { className: "bj-table__pagination", children: /* @__PURE__ */ b(
665
+ sr,
912
666
  {
913
667
  align: "end",
914
- disabled: loading || paginationConfig.disabled,
915
- current,
916
- defaultCurrent: paginationConfig.defaultCurrent,
917
- defaultPageSize: paginationConfig.defaultPageSize,
918
- dropdownClassName: paginationConfig.dropdownClassName,
919
- hideOnSinglePage: paginationConfig.hideOnSinglePage,
920
- onChange: (nextPage) => {
921
- if (ignoreNextPaginationChangeRef.current) {
922
- ignoreNextPaginationChangeRef.current = false;
668
+ disabled: ye || n.disabled,
669
+ current: H,
670
+ defaultCurrent: n.defaultCurrent,
671
+ defaultPageSize: n.defaultPageSize,
672
+ dropdownClassName: n.dropdownClassName,
673
+ hideOnSinglePage: n.hideOnSinglePage,
674
+ onChange: (e) => {
675
+ if (Be.current) {
676
+ Be.current = !1;
923
677
  return;
924
678
  }
925
- changePage(nextPage);
679
+ Qt(e);
926
680
  },
927
- onShowSizeChange: (_, nextPageSize) => changePageSize(nextPageSize),
928
- pageSize,
929
- pageSizeOptions: paginationConfig.pageSizeOptions,
930
- popupPlacement: paginationConfig.popupPlacement,
931
- resolvePopupPlacement: paginationConfig.resolvePopupPlacement,
932
- showQuickJumper: paginationConfig.showQuickJumper,
933
- showSizeChanger: paginationConfig.showSizeChanger,
934
- showTotal: paginationConfig.showTotal,
935
- simple: paginationConfig.simple,
936
- size: paginationConfig.size,
937
- t: paginationConfig.t ?? t,
938
- total
681
+ onShowSizeChange: (e, t) => Zt(t),
682
+ pageSize: W,
683
+ pageSizeOptions: n.pageSizeOptions,
684
+ popupPlacement: n.popupPlacement,
685
+ resolvePopupPlacement: n.resolvePopupPlacement,
686
+ showQuickJumper: n.showQuickJumper,
687
+ showSizeChanger: n.showSizeChanger,
688
+ showTotal: n.showTotal,
689
+ simple: n.simple,
690
+ size: n.size,
691
+ t: n.t ?? C,
692
+ total: et
939
693
  }
940
694
  ) })
941
695
  ]
942
696
  }
943
697
  );
944
698
  }
945
- const CompoundBTable = BTable;
946
- CompoundBTable.Column = Column;
947
- CompoundBTable.ColumnGroup = ColumnGroup;
699
+ const pt = Dr;
700
+ pt.Column = _r;
701
+ pt.ColumnGroup = ur;
948
702
  export {
949
- CompoundBTable as BTable
703
+ pt as BTable
950
704
  };