@expcat/tigercat-react 0.0.65 → 0.0.67
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.
- package/dist/styles/index.css +4 -0
- package/dist/styles/index.d.mts +2 -0
- package/package.json +12 -9
- package/dist/chunk-2DOPHSZP.js +0 -32
- package/dist/chunk-2TS6X5RA.js +0 -73
- package/dist/chunk-2Y327ZU4.js +0 -493
- package/dist/chunk-3OF7XPIQ.js +0 -90
- package/dist/chunk-3WPKVV4N.js +0 -140
- package/dist/chunk-5FRENLDC.js +0 -194
- package/dist/chunk-5QKMQRCW.js +0 -89
- package/dist/chunk-5ZVSFIZD.js +0 -50
- package/dist/chunk-6MGEGOYJ.js +0 -108
- package/dist/chunk-6PUSRC6S.js +0 -68
- package/dist/chunk-72ZRDBXN.js +0 -25
- package/dist/chunk-77D7VQMG.js +0 -43
- package/dist/chunk-7P6PHSFM.js +0 -548
- package/dist/chunk-AG6GVQ5O.js +0 -271
- package/dist/chunk-AQ6DHCP6.js +0 -53
- package/dist/chunk-AQQRWISY.js +0 -184
- package/dist/chunk-C5EFBJBR.js +0 -540
- package/dist/chunk-D3I2SY7X.js +0 -301
- package/dist/chunk-DZJUFU55.js +0 -300
- package/dist/chunk-EI2GHMQS.js +0 -37
- package/dist/chunk-ENR3RIMM.js +0 -205
- package/dist/chunk-EQWQXURG.js +0 -18
- package/dist/chunk-EUHWE7MN.js +0 -267
- package/dist/chunk-FAKTU64M.js +0 -67
- package/dist/chunk-FQ6UHRAO.js +0 -499
- package/dist/chunk-GX74TC62.js +0 -54
- package/dist/chunk-HDDBBZQH.js +0 -321
- package/dist/chunk-IFY46RWU.js +0 -25
- package/dist/chunk-IQINYCU6.js +0 -99
- package/dist/chunk-IY4LEJYF.js +0 -78
- package/dist/chunk-JW64IJP2.js +0 -210
- package/dist/chunk-KUCFT2OA.js +0 -43
- package/dist/chunk-LNKI6HQ3.js +0 -152
- package/dist/chunk-LXA2YBAO.js +0 -38
- package/dist/chunk-MKWXJZ3T.js +0 -74
- package/dist/chunk-NEULKOYJ.js +0 -48
- package/dist/chunk-NI2WNZRT.js +0 -38
- package/dist/chunk-OFCKGWTS.js +0 -12
- package/dist/chunk-OTRGVENC.js +0 -305
- package/dist/chunk-P273E6XE.js +0 -219
- package/dist/chunk-Q3DPJHNM.js +0 -407
- package/dist/chunk-QFVE7GKD.js +0 -109
- package/dist/chunk-QL6OBKEN.js +0 -84
- package/dist/chunk-QL6UEG3U.js +0 -27
- package/dist/chunk-QORSSZX4.js +0 -144
- package/dist/chunk-R4JSBXGG.js +0 -12
- package/dist/chunk-R5BQHZWB.js +0 -698
- package/dist/chunk-R7MS42PL.js +0 -90
- package/dist/chunk-TB2UHDOZ.js +0 -19
- package/dist/chunk-TBIEWDY5.js +0 -175
- package/dist/chunk-TJFS44SH.js +0 -48
- package/dist/chunk-TZ26HQAW.js +0 -85
- package/dist/chunk-U4ZVEPYD.js +0 -71
- package/dist/chunk-UFAXJVMD.js +0 -120
- package/dist/chunk-VJJ76I7U.js +0 -19
- package/dist/chunk-VO4WDK4K.js +0 -37
- package/dist/chunk-VSF4DF7N.js +0 -84
- package/dist/chunk-VVO4V4IK.js +0 -56
- package/dist/chunk-WK5HN4OH.js +0 -113
- package/dist/chunk-XZDJ5FRB.js +0 -333
- package/dist/chunk-YE2M2HNM.js +0 -168
- package/dist/chunk-YYGTJKP5.js +0 -39
- package/dist/chunk-ZREFCRX3.js +0 -52
- package/dist/components/Alert.d.ts +0 -24
- package/dist/components/Alert.js +0 -10
- package/dist/components/Avatar.d.ts +0 -12
- package/dist/components/Avatar.js +0 -10
- package/dist/components/Badge.d.ts +0 -12
- package/dist/components/Badge.js +0 -10
- package/dist/components/Breadcrumb.d.ts +0 -13
- package/dist/components/Breadcrumb.js +0 -14
- package/dist/components/BreadcrumbItem.d.ts +0 -21
- package/dist/components/BreadcrumbItem.js +0 -11
- package/dist/components/Button.d.ts +0 -8
- package/dist/components/Button.js +0 -10
- package/dist/components/Card.d.ts +0 -33
- package/dist/components/Card.js +0 -10
- package/dist/components/Checkbox.d.ts +0 -48
- package/dist/components/Checkbox.js +0 -11
- package/dist/components/CheckboxGroup.d.ts +0 -39
- package/dist/components/CheckboxGroup.js +0 -14
- package/dist/components/Code.d.ts +0 -9
- package/dist/components/Code.js +0 -16
- package/dist/components/Col.d.ts +0 -7
- package/dist/components/Col.js +0 -11
- package/dist/components/ConfigProvider.d.ts +0 -14
- package/dist/components/ConfigProvider.js +0 -14
- package/dist/components/Container.d.ts +0 -13
- package/dist/components/Container.js +0 -10
- package/dist/components/Content.d.ts +0 -9
- package/dist/components/Content.js +0 -10
- package/dist/components/DatePicker.d.ts +0 -24
- package/dist/components/DatePicker.js +0 -10
- package/dist/components/Descriptions.d.ts +0 -53
- package/dist/components/Descriptions.js +0 -16
- package/dist/components/Divider.d.ts +0 -12
- package/dist/components/Divider.js +0 -10
- package/dist/components/Drawer.d.ts +0 -19
- package/dist/components/Drawer.js +0 -11
- package/dist/components/Dropdown.d.ts +0 -22
- package/dist/components/Dropdown.js +0 -16
- package/dist/components/DropdownItem.d.ts +0 -17
- package/dist/components/DropdownItem.js +0 -13
- package/dist/components/DropdownMenu.d.ts +0 -13
- package/dist/components/DropdownMenu.js +0 -10
- package/dist/components/Footer.d.ts +0 -9
- package/dist/components/Footer.js +0 -10
- package/dist/components/Form.d.ts +0 -56
- package/dist/components/Form.js +0 -14
- package/dist/components/FormItem.d.ts +0 -16
- package/dist/components/FormItem.js +0 -11
- package/dist/components/Header.d.ts +0 -9
- package/dist/components/Header.js +0 -10
- package/dist/components/Icon.d.ts +0 -9
- package/dist/components/Icon.js +0 -10
- package/dist/components/Input.d.ts +0 -28
- package/dist/components/Input.js +0 -10
- package/dist/components/Layout.d.ts +0 -9
- package/dist/components/Layout.js +0 -10
- package/dist/components/Link.d.ts +0 -10
- package/dist/components/Link.js +0 -10
- package/dist/components/List.d.ts +0 -94
- package/dist/components/List.js +0 -12
- package/dist/components/Loading.d.ts +0 -8
- package/dist/components/Loading.js +0 -10
- package/dist/components/Menu.d.ts +0 -35
- package/dist/components/Menu.js +0 -14
- package/dist/components/MenuItem.d.ts +0 -20
- package/dist/components/MenuItem.js +0 -11
- package/dist/components/MenuItemGroup.d.ts +0 -16
- package/dist/components/MenuItemGroup.js +0 -12
- package/dist/components/Message.d.ts +0 -44
- package/dist/components/Message.js +0 -20
- package/dist/components/Modal.d.ts +0 -41
- package/dist/components/Modal.js +0 -11
- package/dist/components/Notification.d.ts +0 -40
- package/dist/components/Notification.js +0 -20
- package/dist/components/Pagination.d.ts +0 -11
- package/dist/components/Pagination.js +0 -16
- package/dist/components/Popconfirm.d.ts +0 -34
- package/dist/components/Popconfirm.js +0 -10
- package/dist/components/Popover.d.ts +0 -14
- package/dist/components/Popover.js +0 -10
- package/dist/components/Progress.d.ts +0 -8
- package/dist/components/Progress.js +0 -10
- package/dist/components/Radio.d.ts +0 -20
- package/dist/components/Radio.js +0 -11
- package/dist/components/RadioGroup.d.ts +0 -28
- package/dist/components/RadioGroup.js +0 -14
- package/dist/components/Row.d.ts +0 -11
- package/dist/components/Row.js +0 -14
- package/dist/components/Select.d.ts +0 -23
- package/dist/components/Select.js +0 -10
- package/dist/components/Sidebar.d.ts +0 -9
- package/dist/components/Sidebar.js +0 -10
- package/dist/components/Skeleton.d.ts +0 -7
- package/dist/components/Skeleton.js +0 -10
- package/dist/components/Slider.d.ts +0 -12
- package/dist/components/Slider.js +0 -10
- package/dist/components/Space.d.ts +0 -11
- package/dist/components/Space.js +0 -10
- package/dist/components/Steps.d.ts +0 -31
- package/dist/components/Steps.js +0 -14
- package/dist/components/StepsItem.d.ts +0 -36
- package/dist/components/StepsItem.js +0 -10
- package/dist/components/SubMenu.d.ts +0 -20
- package/dist/components/SubMenu.js +0 -13
- package/dist/components/Switch.d.ts +0 -12
- package/dist/components/Switch.js +0 -10
- package/dist/components/TabPane.d.ts +0 -42
- package/dist/components/TabPane.js +0 -10
- package/dist/components/Table.d.ts +0 -46
- package/dist/components/Table.js +0 -10
- package/dist/components/Tabs.d.ts +0 -43
- package/dist/components/Tabs.js +0 -14
- package/dist/components/Tag.d.ts +0 -16
- package/dist/components/Tag.js +0 -10
- package/dist/components/Text.d.ts +0 -9
- package/dist/components/Text.js +0 -10
- package/dist/components/Textarea.d.ts +0 -13
- package/dist/components/Textarea.js +0 -10
- package/dist/components/TimePicker.d.ts +0 -28
- package/dist/components/TimePicker.js +0 -10
- package/dist/components/Timeline.d.ts +0 -47
- package/dist/components/Timeline.js +0 -10
- package/dist/components/Tooltip.d.ts +0 -15
- package/dist/components/Tooltip.js +0 -10
- package/dist/components/Tree.d.ts +0 -154
- package/dist/components/Tree.js +0 -16
- package/dist/components/Upload.d.ts +0 -16
- package/dist/components/Upload.js +0 -11
- package/dist/index.d.ts +0 -77
- package/dist/index.js +0 -364
package/dist/chunk-R5BQHZWB.js
DELETED
|
@@ -1,698 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var react = require('react');
|
|
4
|
-
var tigercatCore = require('@expcat/tigercat-core');
|
|
5
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
-
|
|
7
|
-
// src/components/Table.tsx
|
|
8
|
-
var spinnerSvg = tigercatCore.getSpinnerSVG("spinner");
|
|
9
|
-
var SortIcon = ({ direction }) => {
|
|
10
|
-
if (direction === "asc") {
|
|
11
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
12
|
-
"svg",
|
|
13
|
-
{
|
|
14
|
-
className: tigercatCore.getSortIconClasses(true),
|
|
15
|
-
width: "16",
|
|
16
|
-
height: "16",
|
|
17
|
-
viewBox: "0 0 16 16",
|
|
18
|
-
fill: "currentColor",
|
|
19
|
-
children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M8 3l4 4H4l4-4z" })
|
|
20
|
-
}
|
|
21
|
-
);
|
|
22
|
-
}
|
|
23
|
-
if (direction === "desc") {
|
|
24
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
25
|
-
"svg",
|
|
26
|
-
{
|
|
27
|
-
className: tigercatCore.getSortIconClasses(true),
|
|
28
|
-
width: "16",
|
|
29
|
-
height: "16",
|
|
30
|
-
viewBox: "0 0 16 16",
|
|
31
|
-
fill: "currentColor",
|
|
32
|
-
children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M8 13l-4-4h8l-4 4z" })
|
|
33
|
-
}
|
|
34
|
-
);
|
|
35
|
-
}
|
|
36
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
37
|
-
"svg",
|
|
38
|
-
{
|
|
39
|
-
className: tigercatCore.getSortIconClasses(false),
|
|
40
|
-
width: "16",
|
|
41
|
-
height: "16",
|
|
42
|
-
viewBox: "0 0 16 16",
|
|
43
|
-
fill: "currentColor",
|
|
44
|
-
children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M8 3l4 4H4l4-4zM8 13l-4-4h8l-4 4z" })
|
|
45
|
-
}
|
|
46
|
-
);
|
|
47
|
-
};
|
|
48
|
-
var LockIcon = ({ locked }) => {
|
|
49
|
-
return /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": "true", children: locked ? /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M17 8h-1V6a4 4 0 10-8 0v2H7a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2V10a2 2 0 00-2-2zm-7-2a2 2 0 114 0v2h-4V6z" }) : /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M17 8h-1V6a4 4 0 00-7.75-1.41 1 1 0 101.9.62A2 2 0 0114 6v2H7a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2V10a2 2 0 00-2-2zm0 12H7V10h10v10z" }) });
|
|
50
|
-
};
|
|
51
|
-
var LoadingSpinner = () => /* @__PURE__ */ jsxRuntime.jsx(
|
|
52
|
-
"svg",
|
|
53
|
-
{
|
|
54
|
-
className: tigercatCore.getLoadingOverlaySpinnerClasses(),
|
|
55
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
56
|
-
fill: "none",
|
|
57
|
-
viewBox: spinnerSvg.viewBox,
|
|
58
|
-
children: spinnerSvg.elements.map((el, index) => {
|
|
59
|
-
if (el.type === "circle") return /* @__PURE__ */ jsxRuntime.jsx("circle", { ...el.attrs }, index);
|
|
60
|
-
if (el.type === "path") return /* @__PURE__ */ jsxRuntime.jsx("path", { ...el.attrs }, index);
|
|
61
|
-
return null;
|
|
62
|
-
})
|
|
63
|
-
}
|
|
64
|
-
);
|
|
65
|
-
function Table({
|
|
66
|
-
columns,
|
|
67
|
-
columnLockable = false,
|
|
68
|
-
dataSource = [],
|
|
69
|
-
sort,
|
|
70
|
-
defaultSort,
|
|
71
|
-
filters,
|
|
72
|
-
defaultFilters,
|
|
73
|
-
size = "md",
|
|
74
|
-
bordered = false,
|
|
75
|
-
striped = false,
|
|
76
|
-
hoverable = true,
|
|
77
|
-
loading = false,
|
|
78
|
-
emptyText = "No data",
|
|
79
|
-
pagination = {
|
|
80
|
-
current: 1,
|
|
81
|
-
pageSize: 10,
|
|
82
|
-
total: 0,
|
|
83
|
-
pageSizeOptions: [10, 20, 50, 100],
|
|
84
|
-
showSizeChanger: true,
|
|
85
|
-
showTotal: true
|
|
86
|
-
},
|
|
87
|
-
rowSelection,
|
|
88
|
-
rowKey = "id",
|
|
89
|
-
rowClassName,
|
|
90
|
-
stickyHeader = false,
|
|
91
|
-
maxHeight,
|
|
92
|
-
onChange,
|
|
93
|
-
onRowClick,
|
|
94
|
-
onSelectionChange,
|
|
95
|
-
onSortChange,
|
|
96
|
-
onFilterChange,
|
|
97
|
-
onPageChange,
|
|
98
|
-
className,
|
|
99
|
-
...props
|
|
100
|
-
}) {
|
|
101
|
-
const isSortControlled = sort !== void 0;
|
|
102
|
-
const isFiltersControlled = filters !== void 0;
|
|
103
|
-
const paginationConfig = pagination !== false && typeof pagination === "object" ? pagination : null;
|
|
104
|
-
const isCurrentPageControlled = paginationConfig?.current !== void 0;
|
|
105
|
-
const isPageSizeControlled = paginationConfig?.pageSize !== void 0;
|
|
106
|
-
const isSelectionControlled = rowSelection?.selectedRowKeys !== void 0 && Array.isArray(rowSelection.selectedRowKeys);
|
|
107
|
-
const [uncontrolledSortState, setUncontrolledSortState] = react.useState(
|
|
108
|
-
defaultSort ?? { key: null, direction: null }
|
|
109
|
-
);
|
|
110
|
-
const [uncontrolledFilterState, setUncontrolledFilterState] = react.useState(
|
|
111
|
-
defaultFilters ?? {}
|
|
112
|
-
);
|
|
113
|
-
const [uncontrolledCurrentPage, setUncontrolledCurrentPage] = react.useState(
|
|
114
|
-
() => paginationConfig?.defaultCurrent ?? paginationConfig?.current ?? 1
|
|
115
|
-
);
|
|
116
|
-
const [uncontrolledCurrentPageSize, setUncontrolledCurrentPageSize] = react.useState(
|
|
117
|
-
() => paginationConfig?.defaultPageSize ?? paginationConfig?.pageSize ?? 10
|
|
118
|
-
);
|
|
119
|
-
const [uncontrolledSelectedRowKeys, setUncontrolledSelectedRowKeys] = react.useState(rowSelection?.defaultSelectedRowKeys ?? rowSelection?.selectedRowKeys ?? []);
|
|
120
|
-
const sortState = isSortControlled ? sort : uncontrolledSortState;
|
|
121
|
-
const filterState = isFiltersControlled ? filters : uncontrolledFilterState;
|
|
122
|
-
const currentPage = isCurrentPageControlled ? paginationConfig.current : uncontrolledCurrentPage;
|
|
123
|
-
const currentPageSize = isPageSizeControlled ? paginationConfig.pageSize : uncontrolledCurrentPageSize;
|
|
124
|
-
const selectedRowKeys = isSelectionControlled ? rowSelection.selectedRowKeys : uncontrolledSelectedRowKeys;
|
|
125
|
-
react.useEffect(() => {
|
|
126
|
-
if (isSortControlled && sort) {
|
|
127
|
-
setUncontrolledSortState(sort);
|
|
128
|
-
}
|
|
129
|
-
}, [isSortControlled, sort?.key, sort?.direction]);
|
|
130
|
-
react.useEffect(() => {
|
|
131
|
-
if (isFiltersControlled && filters) {
|
|
132
|
-
setUncontrolledFilterState(filters);
|
|
133
|
-
}
|
|
134
|
-
}, [isFiltersControlled, filters]);
|
|
135
|
-
react.useEffect(() => {
|
|
136
|
-
if (isCurrentPageControlled) {
|
|
137
|
-
setUncontrolledCurrentPage(paginationConfig.current);
|
|
138
|
-
}
|
|
139
|
-
}, [isCurrentPageControlled, paginationConfig?.current]);
|
|
140
|
-
react.useEffect(() => {
|
|
141
|
-
if (isPageSizeControlled) {
|
|
142
|
-
setUncontrolledCurrentPageSize(paginationConfig.pageSize);
|
|
143
|
-
}
|
|
144
|
-
}, [isPageSizeControlled, paginationConfig?.pageSize]);
|
|
145
|
-
react.useEffect(() => {
|
|
146
|
-
if (isSelectionControlled) {
|
|
147
|
-
setUncontrolledSelectedRowKeys(rowSelection?.selectedRowKeys ?? []);
|
|
148
|
-
}
|
|
149
|
-
}, [isSelectionControlled, rowSelection?.selectedRowKeys]);
|
|
150
|
-
const [fixedOverrides, setFixedOverrides] = react.useState({});
|
|
151
|
-
const displayColumns = react.useMemo(() => {
|
|
152
|
-
return columns.map((column) => {
|
|
153
|
-
const hasOverride = Object.prototype.hasOwnProperty.call(fixedOverrides, column.key);
|
|
154
|
-
return {
|
|
155
|
-
...column,
|
|
156
|
-
fixed: hasOverride ? fixedOverrides[column.key] : column.fixed
|
|
157
|
-
};
|
|
158
|
-
});
|
|
159
|
-
}, [columns, fixedOverrides]);
|
|
160
|
-
const columnByKey = react.useMemo(() => {
|
|
161
|
-
const map = {};
|
|
162
|
-
for (const column of displayColumns) {
|
|
163
|
-
map[column.key] = column;
|
|
164
|
-
}
|
|
165
|
-
return map;
|
|
166
|
-
}, [displayColumns]);
|
|
167
|
-
const fixedColumnsInfo = react.useMemo(() => {
|
|
168
|
-
return tigercatCore.getFixedColumnOffsets(displayColumns);
|
|
169
|
-
}, [displayColumns]);
|
|
170
|
-
const toggleColumnLock = react.useCallback(
|
|
171
|
-
(columnKey) => {
|
|
172
|
-
setFixedOverrides((prev) => {
|
|
173
|
-
const original = columns.find((c) => c.key === columnKey)?.fixed;
|
|
174
|
-
const current = Object.prototype.hasOwnProperty.call(prev, columnKey) ? prev[columnKey] : original;
|
|
175
|
-
const isLocked = current === "left" || current === "right";
|
|
176
|
-
return {
|
|
177
|
-
...prev,
|
|
178
|
-
[columnKey]: isLocked ? false : "left"
|
|
179
|
-
};
|
|
180
|
-
});
|
|
181
|
-
},
|
|
182
|
-
[columns]
|
|
183
|
-
);
|
|
184
|
-
const processedData = react.useMemo(() => {
|
|
185
|
-
let data = dataSource;
|
|
186
|
-
data = tigercatCore.filterData(data, filterState);
|
|
187
|
-
if (sortState.key && sortState.direction) {
|
|
188
|
-
const column = columnByKey[sortState.key];
|
|
189
|
-
data = tigercatCore.sortData(data, sortState.key, sortState.direction, column?.sortFn);
|
|
190
|
-
}
|
|
191
|
-
return data;
|
|
192
|
-
}, [dataSource, filterState, sortState, columnByKey]);
|
|
193
|
-
const paginatedData = react.useMemo(() => {
|
|
194
|
-
if (pagination === false) {
|
|
195
|
-
return processedData;
|
|
196
|
-
}
|
|
197
|
-
return tigercatCore.paginateData(processedData, currentPage, currentPageSize);
|
|
198
|
-
}, [processedData, currentPage, currentPageSize, pagination]);
|
|
199
|
-
const pageRowKeys = react.useMemo(
|
|
200
|
-
() => paginatedData.map((record, index) => tigercatCore.getRowKey(record, rowKey, index)),
|
|
201
|
-
[paginatedData, rowKey]
|
|
202
|
-
);
|
|
203
|
-
const selectedRowKeySet = react.useMemo(
|
|
204
|
-
() => new Set(selectedRowKeys),
|
|
205
|
-
[selectedRowKeys]
|
|
206
|
-
);
|
|
207
|
-
const paginationInfo = react.useMemo(() => {
|
|
208
|
-
if (pagination === false) {
|
|
209
|
-
return null;
|
|
210
|
-
}
|
|
211
|
-
const total = processedData.length;
|
|
212
|
-
return tigercatCore.calculatePagination(total, currentPage, currentPageSize);
|
|
213
|
-
}, [processedData.length, currentPage, currentPageSize, pagination]);
|
|
214
|
-
const handleSort = react.useCallback(
|
|
215
|
-
(columnKey) => {
|
|
216
|
-
const column = columnByKey[columnKey];
|
|
217
|
-
if (!column || !column.sortable) {
|
|
218
|
-
return;
|
|
219
|
-
}
|
|
220
|
-
let newDirection = "asc";
|
|
221
|
-
if (sortState.key === columnKey) {
|
|
222
|
-
if (sortState.direction === "asc") {
|
|
223
|
-
newDirection = "desc";
|
|
224
|
-
} else if (sortState.direction === "desc") {
|
|
225
|
-
newDirection = null;
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
const newSortState = {
|
|
229
|
-
key: newDirection ? columnKey : null,
|
|
230
|
-
direction: newDirection
|
|
231
|
-
};
|
|
232
|
-
if (!isSortControlled) {
|
|
233
|
-
setUncontrolledSortState(newSortState);
|
|
234
|
-
}
|
|
235
|
-
onSortChange?.(newSortState);
|
|
236
|
-
onChange?.({
|
|
237
|
-
sort: newSortState,
|
|
238
|
-
filters: filterState,
|
|
239
|
-
pagination: pagination !== false ? {
|
|
240
|
-
current: currentPage,
|
|
241
|
-
pageSize: currentPageSize
|
|
242
|
-
} : null
|
|
243
|
-
});
|
|
244
|
-
},
|
|
245
|
-
[
|
|
246
|
-
columnByKey,
|
|
247
|
-
sortState,
|
|
248
|
-
filterState,
|
|
249
|
-
currentPage,
|
|
250
|
-
currentPageSize,
|
|
251
|
-
pagination,
|
|
252
|
-
isSortControlled,
|
|
253
|
-
onSortChange,
|
|
254
|
-
onChange
|
|
255
|
-
]
|
|
256
|
-
);
|
|
257
|
-
const handleFilter = react.useCallback(
|
|
258
|
-
(columnKey, value) => {
|
|
259
|
-
const newFilterState = {
|
|
260
|
-
...filterState,
|
|
261
|
-
[columnKey]: value
|
|
262
|
-
};
|
|
263
|
-
if (!isFiltersControlled) {
|
|
264
|
-
setUncontrolledFilterState(newFilterState);
|
|
265
|
-
}
|
|
266
|
-
setUncontrolledCurrentPage(1);
|
|
267
|
-
onFilterChange?.(newFilterState);
|
|
268
|
-
onChange?.({
|
|
269
|
-
sort: sortState,
|
|
270
|
-
filters: newFilterState,
|
|
271
|
-
pagination: pagination !== false ? {
|
|
272
|
-
current: 1,
|
|
273
|
-
pageSize: currentPageSize
|
|
274
|
-
} : null
|
|
275
|
-
});
|
|
276
|
-
},
|
|
277
|
-
[
|
|
278
|
-
filterState,
|
|
279
|
-
sortState,
|
|
280
|
-
currentPageSize,
|
|
281
|
-
pagination,
|
|
282
|
-
isFiltersControlled,
|
|
283
|
-
onFilterChange,
|
|
284
|
-
onChange
|
|
285
|
-
]
|
|
286
|
-
);
|
|
287
|
-
const handlePageChange = react.useCallback(
|
|
288
|
-
(page) => {
|
|
289
|
-
if (!isCurrentPageControlled) {
|
|
290
|
-
setUncontrolledCurrentPage(page);
|
|
291
|
-
} else {
|
|
292
|
-
setUncontrolledCurrentPage(page);
|
|
293
|
-
}
|
|
294
|
-
onPageChange?.({ current: page, pageSize: currentPageSize });
|
|
295
|
-
onChange?.({
|
|
296
|
-
sort: sortState,
|
|
297
|
-
filters: filterState,
|
|
298
|
-
pagination: {
|
|
299
|
-
current: page,
|
|
300
|
-
pageSize: currentPageSize
|
|
301
|
-
}
|
|
302
|
-
});
|
|
303
|
-
},
|
|
304
|
-
[currentPageSize, sortState, filterState, isCurrentPageControlled, onPageChange, onChange]
|
|
305
|
-
);
|
|
306
|
-
const handlePageSizeChange = react.useCallback(
|
|
307
|
-
(pageSize) => {
|
|
308
|
-
if (!isPageSizeControlled) {
|
|
309
|
-
setUncontrolledCurrentPageSize(pageSize);
|
|
310
|
-
} else {
|
|
311
|
-
setUncontrolledCurrentPageSize(pageSize);
|
|
312
|
-
}
|
|
313
|
-
if (!isCurrentPageControlled) {
|
|
314
|
-
setUncontrolledCurrentPage(1);
|
|
315
|
-
} else {
|
|
316
|
-
setUncontrolledCurrentPage(1);
|
|
317
|
-
}
|
|
318
|
-
onPageChange?.({ current: 1, pageSize });
|
|
319
|
-
onChange?.({
|
|
320
|
-
sort: sortState,
|
|
321
|
-
filters: filterState,
|
|
322
|
-
pagination: {
|
|
323
|
-
current: 1,
|
|
324
|
-
pageSize
|
|
325
|
-
}
|
|
326
|
-
});
|
|
327
|
-
},
|
|
328
|
-
[sortState, filterState, isPageSizeControlled, isCurrentPageControlled, onPageChange, onChange]
|
|
329
|
-
);
|
|
330
|
-
const handleRowClick = react.useCallback(
|
|
331
|
-
(record, index) => {
|
|
332
|
-
onRowClick?.(record, index);
|
|
333
|
-
},
|
|
334
|
-
[onRowClick]
|
|
335
|
-
);
|
|
336
|
-
const handleSelectRow = react.useCallback(
|
|
337
|
-
(key, checked) => {
|
|
338
|
-
let newKeys;
|
|
339
|
-
if (rowSelection?.type === "radio") {
|
|
340
|
-
newKeys = checked ? [key] : [];
|
|
341
|
-
} else {
|
|
342
|
-
if (checked) {
|
|
343
|
-
newKeys = [...selectedRowKeys, key];
|
|
344
|
-
} else {
|
|
345
|
-
newKeys = selectedRowKeys.filter((k) => k !== key);
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
if (!isSelectionControlled) {
|
|
349
|
-
setUncontrolledSelectedRowKeys(newKeys);
|
|
350
|
-
}
|
|
351
|
-
onSelectionChange?.(newKeys);
|
|
352
|
-
},
|
|
353
|
-
[rowSelection, selectedRowKeys, isSelectionControlled, onSelectionChange]
|
|
354
|
-
);
|
|
355
|
-
const handleSelectAll = react.useCallback(
|
|
356
|
-
(checked) => {
|
|
357
|
-
if (checked) {
|
|
358
|
-
const newKeys = pageRowKeys;
|
|
359
|
-
if (!isSelectionControlled) {
|
|
360
|
-
setUncontrolledSelectedRowKeys(newKeys);
|
|
361
|
-
}
|
|
362
|
-
onSelectionChange?.(newKeys);
|
|
363
|
-
} else {
|
|
364
|
-
if (!isSelectionControlled) {
|
|
365
|
-
setUncontrolledSelectedRowKeys([]);
|
|
366
|
-
}
|
|
367
|
-
onSelectionChange?.([]);
|
|
368
|
-
}
|
|
369
|
-
},
|
|
370
|
-
[pageRowKeys, isSelectionControlled, onSelectionChange]
|
|
371
|
-
);
|
|
372
|
-
const allSelected = react.useMemo(() => {
|
|
373
|
-
if (pageRowKeys.length === 0) {
|
|
374
|
-
return false;
|
|
375
|
-
}
|
|
376
|
-
return pageRowKeys.every((key) => selectedRowKeySet.has(key));
|
|
377
|
-
}, [pageRowKeys, selectedRowKeySet]);
|
|
378
|
-
const someSelected = react.useMemo(() => {
|
|
379
|
-
return selectedRowKeys.length > 0 && !allSelected;
|
|
380
|
-
}, [selectedRowKeys.length, allSelected]);
|
|
381
|
-
const renderTableHeader = react.useCallback(() => {
|
|
382
|
-
return /* @__PURE__ */ jsxRuntime.jsx("thead", { className: tigercatCore.getTableHeaderClasses(stickyHeader), children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
383
|
-
rowSelection && rowSelection.showCheckbox !== false && rowSelection.type !== "radio" && /* @__PURE__ */ jsxRuntime.jsx("th", { className: tigercatCore.getCheckboxCellClasses(size), children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
384
|
-
"input",
|
|
385
|
-
{
|
|
386
|
-
type: "checkbox",
|
|
387
|
-
className: "rounded border-gray-300 text-[var(--tiger-primary,#2563eb)] focus:ring-[var(--tiger-primary,#2563eb)]",
|
|
388
|
-
checked: allSelected,
|
|
389
|
-
ref: (el) => {
|
|
390
|
-
if (el) el.indeterminate = someSelected;
|
|
391
|
-
},
|
|
392
|
-
onChange: (e) => handleSelectAll(e.target.checked)
|
|
393
|
-
}
|
|
394
|
-
) }),
|
|
395
|
-
displayColumns.map((column) => {
|
|
396
|
-
const isSorted = sortState.key === column.key;
|
|
397
|
-
const sortDirection = isSorted ? sortState.direction : null;
|
|
398
|
-
const ariaSort = column.sortable ? sortDirection === "asc" ? "ascending" : sortDirection === "desc" ? "descending" : "none" : void 0;
|
|
399
|
-
const isFixedLeft = column.fixed === "left";
|
|
400
|
-
const isFixedRight = column.fixed === "right";
|
|
401
|
-
const fixedStyle = isFixedLeft ? {
|
|
402
|
-
position: "sticky",
|
|
403
|
-
left: `${fixedColumnsInfo.leftOffsets[column.key] || 0}px`,
|
|
404
|
-
zIndex: 15
|
|
405
|
-
} : isFixedRight ? {
|
|
406
|
-
position: "sticky",
|
|
407
|
-
right: `${fixedColumnsInfo.rightOffsets[column.key] || 0}px`,
|
|
408
|
-
zIndex: 15
|
|
409
|
-
} : void 0;
|
|
410
|
-
const widthStyle = column.width ? {
|
|
411
|
-
width: typeof column.width === "number" ? `${column.width}px` : column.width
|
|
412
|
-
} : void 0;
|
|
413
|
-
const style = fixedStyle ? { ...widthStyle, ...fixedStyle } : widthStyle;
|
|
414
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
415
|
-
"th",
|
|
416
|
-
{
|
|
417
|
-
"aria-sort": ariaSort,
|
|
418
|
-
className: tigercatCore.classNames(
|
|
419
|
-
tigercatCore.getTableHeaderCellClasses(
|
|
420
|
-
size,
|
|
421
|
-
column.align || "left",
|
|
422
|
-
!!column.sortable,
|
|
423
|
-
column.headerClassName
|
|
424
|
-
),
|
|
425
|
-
(isFixedLeft || isFixedRight) && "bg-gray-50"
|
|
426
|
-
),
|
|
427
|
-
style,
|
|
428
|
-
onClick: column.sortable ? () => handleSort(column.key) : void 0,
|
|
429
|
-
children: [
|
|
430
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
431
|
-
column.renderHeader ? column.renderHeader() : column.title,
|
|
432
|
-
columnLockable && /* @__PURE__ */ jsxRuntime.jsx(
|
|
433
|
-
"button",
|
|
434
|
-
{
|
|
435
|
-
type: "button",
|
|
436
|
-
"aria-label": column.fixed === "left" || column.fixed === "right" ? `Unlock column ${column.title}` : `Lock column ${column.title}`,
|
|
437
|
-
className: tigercatCore.classNames(
|
|
438
|
-
"inline-flex items-center",
|
|
439
|
-
column.fixed === "left" || column.fixed === "right" ? "text-[var(--tiger-primary,#2563eb)]" : "text-gray-400 hover:text-gray-700"
|
|
440
|
-
),
|
|
441
|
-
onClick: (e) => {
|
|
442
|
-
e.stopPropagation();
|
|
443
|
-
toggleColumnLock(column.key);
|
|
444
|
-
},
|
|
445
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(LockIcon, { locked: column.fixed === "left" || column.fixed === "right" })
|
|
446
|
-
}
|
|
447
|
-
),
|
|
448
|
-
column.sortable && /* @__PURE__ */ jsxRuntime.jsx(SortIcon, { direction: sortDirection })
|
|
449
|
-
] }),
|
|
450
|
-
column.filter && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-2", children: column.filter.type === "select" && column.filter.options ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
451
|
-
"select",
|
|
452
|
-
{
|
|
453
|
-
className: "w-full px-2 py-1 text-sm border border-gray-300 rounded",
|
|
454
|
-
onChange: (e) => handleFilter(column.key, e.target.value),
|
|
455
|
-
onClick: (e) => e.stopPropagation(),
|
|
456
|
-
children: [
|
|
457
|
-
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "", children: "All" }),
|
|
458
|
-
column.filter.options.map((opt) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: opt.value, children: opt.label }, opt.value))
|
|
459
|
-
]
|
|
460
|
-
}
|
|
461
|
-
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
462
|
-
"input",
|
|
463
|
-
{
|
|
464
|
-
type: "text",
|
|
465
|
-
className: "w-full px-2 py-1 text-sm border border-gray-300 rounded",
|
|
466
|
-
placeholder: column.filter.placeholder || "Filter...",
|
|
467
|
-
onInput: (e) => handleFilter(column.key, e.target.value),
|
|
468
|
-
onClick: (e) => e.stopPropagation()
|
|
469
|
-
}
|
|
470
|
-
) })
|
|
471
|
-
]
|
|
472
|
-
},
|
|
473
|
-
column.key
|
|
474
|
-
);
|
|
475
|
-
})
|
|
476
|
-
] }) });
|
|
477
|
-
}, [
|
|
478
|
-
displayColumns,
|
|
479
|
-
size,
|
|
480
|
-
stickyHeader,
|
|
481
|
-
sortState,
|
|
482
|
-
rowSelection,
|
|
483
|
-
allSelected,
|
|
484
|
-
someSelected,
|
|
485
|
-
handleSort,
|
|
486
|
-
handleFilter,
|
|
487
|
-
handleSelectAll,
|
|
488
|
-
columnLockable,
|
|
489
|
-
toggleColumnLock,
|
|
490
|
-
fixedColumnsInfo
|
|
491
|
-
]);
|
|
492
|
-
const renderTableBody = react.useCallback(() => {
|
|
493
|
-
if (loading) {
|
|
494
|
-
return null;
|
|
495
|
-
}
|
|
496
|
-
if (paginatedData.length === 0) {
|
|
497
|
-
return /* @__PURE__ */ jsxRuntime.jsx("tbody", { children: /* @__PURE__ */ jsxRuntime.jsx("tr", { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
498
|
-
"td",
|
|
499
|
-
{
|
|
500
|
-
colSpan: displayColumns.length + (rowSelection ? 1 : 0),
|
|
501
|
-
className: tigercatCore.tableEmptyStateClasses,
|
|
502
|
-
children: /* @__PURE__ */ jsxRuntime.jsx("div", { role: "status", "aria-live": "polite", children: emptyText })
|
|
503
|
-
}
|
|
504
|
-
) }) });
|
|
505
|
-
}
|
|
506
|
-
return /* @__PURE__ */ jsxRuntime.jsx("tbody", { children: paginatedData.map((record, index) => {
|
|
507
|
-
const key = pageRowKeys[index];
|
|
508
|
-
const isSelected = selectedRowKeySet.has(key);
|
|
509
|
-
const rowClass = typeof rowClassName === "function" ? rowClassName(record, index) : rowClassName;
|
|
510
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
511
|
-
"tr",
|
|
512
|
-
{
|
|
513
|
-
className: tigercatCore.classNames(
|
|
514
|
-
tigercatCore.getTableRowClasses(hoverable, striped, index % 2 === 0, rowClass),
|
|
515
|
-
fixedColumnsInfo.hasFixedColumns && "group"
|
|
516
|
-
),
|
|
517
|
-
onClick: () => handleRowClick(record, index),
|
|
518
|
-
children: [
|
|
519
|
-
rowSelection && rowSelection.showCheckbox !== false && /* @__PURE__ */ jsxRuntime.jsx("td", { className: tigercatCore.getCheckboxCellClasses(size), children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
520
|
-
"input",
|
|
521
|
-
{
|
|
522
|
-
type: rowSelection?.type === "radio" ? "radio" : "checkbox",
|
|
523
|
-
className: rowSelection?.type === "radio" ? "border-gray-300 text-[var(--tiger-primary,#2563eb)] focus:ring-[var(--tiger-primary,#2563eb)]" : "rounded border-gray-300 text-[var(--tiger-primary,#2563eb)] focus:ring-[var(--tiger-primary,#2563eb)]",
|
|
524
|
-
checked: isSelected,
|
|
525
|
-
disabled: rowSelection?.getCheckboxProps?.(record)?.disabled,
|
|
526
|
-
onChange: (e) => handleSelectRow(key, e.target.checked),
|
|
527
|
-
onClick: (e) => e.stopPropagation()
|
|
528
|
-
}
|
|
529
|
-
) }),
|
|
530
|
-
displayColumns.map((column) => {
|
|
531
|
-
const dataKey = column.dataKey || column.key;
|
|
532
|
-
const cellValue = record[dataKey];
|
|
533
|
-
const isFixedLeft = column.fixed === "left";
|
|
534
|
-
const isFixedRight = column.fixed === "right";
|
|
535
|
-
const fixedStyle = isFixedLeft ? {
|
|
536
|
-
position: "sticky",
|
|
537
|
-
left: `${fixedColumnsInfo.leftOffsets[column.key] || 0}px`,
|
|
538
|
-
zIndex: 10
|
|
539
|
-
} : isFixedRight ? {
|
|
540
|
-
position: "sticky",
|
|
541
|
-
right: `${fixedColumnsInfo.rightOffsets[column.key] || 0}px`,
|
|
542
|
-
zIndex: 10
|
|
543
|
-
} : void 0;
|
|
544
|
-
const widthStyle = column.width ? {
|
|
545
|
-
width: typeof column.width === "number" ? `${column.width}px` : column.width
|
|
546
|
-
} : void 0;
|
|
547
|
-
const style = fixedStyle ? { ...widthStyle, ...fixedStyle } : widthStyle;
|
|
548
|
-
const stickyBgClass = striped && index % 2 === 0 ? "bg-gray-50/50" : "bg-white";
|
|
549
|
-
const stickyCellClass = isFixedLeft || isFixedRight ? tigercatCore.classNames(stickyBgClass, hoverable && "group-hover:bg-gray-50") : void 0;
|
|
550
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
551
|
-
"td",
|
|
552
|
-
{
|
|
553
|
-
className: tigercatCore.classNames(
|
|
554
|
-
tigercatCore.getTableCellClasses(size, column.align || "left", column.className),
|
|
555
|
-
stickyCellClass
|
|
556
|
-
),
|
|
557
|
-
style,
|
|
558
|
-
children: column.render ? column.render(record, index) : cellValue
|
|
559
|
-
},
|
|
560
|
-
column.key
|
|
561
|
-
);
|
|
562
|
-
})
|
|
563
|
-
]
|
|
564
|
-
},
|
|
565
|
-
key
|
|
566
|
-
);
|
|
567
|
-
}) });
|
|
568
|
-
}, [
|
|
569
|
-
loading,
|
|
570
|
-
paginatedData,
|
|
571
|
-
displayColumns,
|
|
572
|
-
rowSelection,
|
|
573
|
-
emptyText,
|
|
574
|
-
pageRowKeys,
|
|
575
|
-
selectedRowKeySet,
|
|
576
|
-
rowClassName,
|
|
577
|
-
hoverable,
|
|
578
|
-
striped,
|
|
579
|
-
size,
|
|
580
|
-
handleRowClick,
|
|
581
|
-
handleSelectRow,
|
|
582
|
-
fixedColumnsInfo
|
|
583
|
-
]);
|
|
584
|
-
const renderPagination = react.useCallback(() => {
|
|
585
|
-
if (pagination === false || !paginationInfo) {
|
|
586
|
-
return null;
|
|
587
|
-
}
|
|
588
|
-
const { totalPages, startIndex, endIndex, hasNext, hasPrev } = paginationInfo;
|
|
589
|
-
const total = processedData.length;
|
|
590
|
-
const paginationConfig2 = pagination;
|
|
591
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: tigercatCore.tablePaginationContainerClasses, children: [
|
|
592
|
-
paginationConfig2.showTotal !== false && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm text-gray-700", children: paginationConfig2.totalText ? paginationConfig2.totalText(total, [startIndex, endIndex]) : `Showing ${startIndex} to ${endIndex} of ${total} results` }),
|
|
593
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
594
|
-
paginationConfig2.showSizeChanger !== false && /* @__PURE__ */ jsxRuntime.jsx(
|
|
595
|
-
"select",
|
|
596
|
-
{
|
|
597
|
-
className: "px-3 py-1 border border-gray-300 rounded text-sm",
|
|
598
|
-
value: currentPageSize,
|
|
599
|
-
onChange: (e) => handlePageSizeChange(Number(e.target.value)),
|
|
600
|
-
children: (paginationConfig2.pageSizeOptions || [10, 20, 50, 100]).map((size2) => /* @__PURE__ */ jsxRuntime.jsxs("option", { value: size2, children: [
|
|
601
|
-
size2,
|
|
602
|
-
" / page"
|
|
603
|
-
] }, size2))
|
|
604
|
-
}
|
|
605
|
-
),
|
|
606
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-1", children: [
|
|
607
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
608
|
-
"button",
|
|
609
|
-
{
|
|
610
|
-
className: tigercatCore.classNames(
|
|
611
|
-
"px-3 py-1 border border-gray-300 rounded text-sm",
|
|
612
|
-
hasPrev ? "hover:bg-gray-50 text-gray-700" : "text-gray-400 cursor-not-allowed"
|
|
613
|
-
),
|
|
614
|
-
disabled: !hasPrev,
|
|
615
|
-
onClick: () => handlePageChange(currentPage - 1),
|
|
616
|
-
children: "Previous"
|
|
617
|
-
}
|
|
618
|
-
),
|
|
619
|
-
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "px-3 py-1 text-sm text-gray-700", children: [
|
|
620
|
-
"Page ",
|
|
621
|
-
currentPage,
|
|
622
|
-
" of ",
|
|
623
|
-
totalPages
|
|
624
|
-
] }),
|
|
625
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
626
|
-
"button",
|
|
627
|
-
{
|
|
628
|
-
className: tigercatCore.classNames(
|
|
629
|
-
"px-3 py-1 border border-gray-300 rounded text-sm",
|
|
630
|
-
hasNext ? "hover:bg-gray-50 text-gray-700" : "text-gray-400 cursor-not-allowed"
|
|
631
|
-
),
|
|
632
|
-
disabled: !hasNext,
|
|
633
|
-
onClick: () => handlePageChange(currentPage + 1),
|
|
634
|
-
children: "Next"
|
|
635
|
-
}
|
|
636
|
-
)
|
|
637
|
-
] })
|
|
638
|
-
] })
|
|
639
|
-
] });
|
|
640
|
-
}, [
|
|
641
|
-
pagination,
|
|
642
|
-
paginationInfo,
|
|
643
|
-
processedData.length,
|
|
644
|
-
currentPage,
|
|
645
|
-
currentPageSize,
|
|
646
|
-
handlePageChange,
|
|
647
|
-
handlePageSizeChange
|
|
648
|
-
]);
|
|
649
|
-
const wrapperStyle = react.useMemo(
|
|
650
|
-
() => maxHeight ? {
|
|
651
|
-
maxHeight: typeof maxHeight === "number" ? `${maxHeight}px` : maxHeight
|
|
652
|
-
} : void 0,
|
|
653
|
-
[maxHeight]
|
|
654
|
-
);
|
|
655
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: tigercatCore.classNames("relative", className), children: [
|
|
656
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
657
|
-
"div",
|
|
658
|
-
{
|
|
659
|
-
className: tigercatCore.getTableWrapperClasses(bordered, maxHeight),
|
|
660
|
-
style: wrapperStyle,
|
|
661
|
-
"aria-busy": loading,
|
|
662
|
-
children: [
|
|
663
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
664
|
-
"table",
|
|
665
|
-
{
|
|
666
|
-
className: tigercatCore.tableBaseClasses,
|
|
667
|
-
...props,
|
|
668
|
-
style: fixedColumnsInfo.hasFixedColumns && fixedColumnsInfo.minTableWidth ? {
|
|
669
|
-
...props.style,
|
|
670
|
-
minWidth: `${fixedColumnsInfo.minTableWidth}px`
|
|
671
|
-
} : props.style,
|
|
672
|
-
children: [
|
|
673
|
-
renderTableHeader(),
|
|
674
|
-
renderTableBody()
|
|
675
|
-
]
|
|
676
|
-
}
|
|
677
|
-
),
|
|
678
|
-
loading && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
679
|
-
"div",
|
|
680
|
-
{
|
|
681
|
-
className: tigercatCore.tableLoadingOverlayClasses,
|
|
682
|
-
role: "status",
|
|
683
|
-
"aria-live": "polite",
|
|
684
|
-
"aria-label": "Loading",
|
|
685
|
-
children: [
|
|
686
|
-
/* @__PURE__ */ jsxRuntime.jsx(LoadingSpinner, {}),
|
|
687
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Loading" })
|
|
688
|
-
]
|
|
689
|
-
}
|
|
690
|
-
)
|
|
691
|
-
]
|
|
692
|
-
}
|
|
693
|
-
),
|
|
694
|
-
renderPagination()
|
|
695
|
-
] });
|
|
696
|
-
}
|
|
697
|
-
|
|
698
|
-
exports.Table = Table;
|