react-restyle-components 0.4.23 → 0.4.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/src/core-components/src/components/AlertBanner/AlertBanner.d.ts +4 -0
- package/lib/src/core-components/src/components/AlertBanner/AlertBanner.d.ts.map +1 -0
- package/lib/src/core-components/src/components/AlertBanner/AlertBanner.js +45 -0
- package/lib/src/core-components/src/components/AlertBanner/elements.d.ts +27 -0
- package/lib/src/core-components/src/components/AlertBanner/elements.d.ts.map +1 -0
- package/lib/src/core-components/src/components/AlertBanner/elements.js +233 -0
- package/lib/src/core-components/src/components/AlertBanner/index.d.ts +3 -0
- package/lib/src/core-components/src/components/AlertBanner/index.d.ts.map +1 -0
- package/lib/src/core-components/src/components/AlertBanner/index.js +2 -0
- package/lib/src/core-components/src/components/AlertBanner/types.d.ts +46 -0
- package/lib/src/core-components/src/components/AlertBanner/types.d.ts.map +1 -0
- package/lib/src/core-components/src/components/AlertBanner/types.js +10 -0
- package/lib/src/core-components/src/components/AutoComplete/auto-complete-filter-multiple-select-multiple-fields-display/auto-complete-filter-multiple-select-multiple-fields-display.component.d.ts.map +1 -1
- package/lib/src/core-components/src/components/Badge/Badge.d.ts +33 -33
- package/lib/src/core-components/src/components/Breadcrumb/Breadcrumb.d.ts +28 -0
- package/lib/src/core-components/src/components/Breadcrumb/Breadcrumb.d.ts.map +1 -0
- package/lib/src/core-components/src/components/Breadcrumb/Breadcrumb.js +83 -0
- package/lib/src/core-components/src/components/Breadcrumb/elements.d.ts +44 -0
- package/lib/src/core-components/src/components/Breadcrumb/elements.d.ts.map +1 -0
- package/lib/src/core-components/src/components/Breadcrumb/elements.js +370 -0
- package/lib/src/core-components/src/components/Breadcrumb/index.d.ts +4 -0
- package/lib/src/core-components/src/components/Breadcrumb/index.d.ts.map +1 -0
- package/lib/src/core-components/src/components/Breadcrumb/index.js +3 -0
- package/lib/src/core-components/src/components/Breadcrumb/types.d.ts +14 -0
- package/lib/src/core-components/src/components/Breadcrumb/types.d.ts.map +1 -0
- package/lib/src/core-components/src/components/Breadcrumb/types.js +3 -0
- package/lib/src/core-components/src/components/Button/Button.spec.js +1 -1
- package/lib/src/core-components/src/components/Button/button.component.js +1 -1
- package/lib/src/core-components/src/components/Chip/Chip.d.ts +5 -0
- package/lib/src/core-components/src/components/Chip/Chip.d.ts.map +1 -0
- package/lib/src/core-components/src/components/Chip/Chip.js +64 -0
- package/lib/src/core-components/src/components/Chip/elements.d.ts +27 -0
- package/lib/src/core-components/src/components/Chip/elements.d.ts.map +1 -0
- package/lib/src/core-components/src/components/Chip/elements.js +253 -0
- package/lib/src/core-components/src/components/Chip/index.d.ts +3 -0
- package/lib/src/core-components/src/components/Chip/index.d.ts.map +1 -0
- package/lib/src/core-components/src/components/Chip/index.js +2 -0
- package/lib/src/core-components/src/components/Chip/types.d.ts +54 -0
- package/lib/src/core-components/src/components/Chip/types.d.ts.map +1 -0
- package/lib/src/core-components/src/components/Chip/types.js +4 -0
- package/lib/src/core-components/src/components/Divider/Divider.d.ts +4 -0
- package/lib/src/core-components/src/components/Divider/Divider.d.ts.map +1 -0
- package/lib/src/core-components/src/components/Divider/Divider.js +25 -0
- package/lib/src/core-components/src/components/Divider/elements.d.ts +22 -0
- package/lib/src/core-components/src/components/Divider/elements.d.ts.map +1 -0
- package/lib/src/core-components/src/components/Divider/elements.js +103 -0
- package/lib/src/core-components/src/components/Divider/index.d.ts +3 -0
- package/lib/src/core-components/src/components/Divider/index.d.ts.map +1 -0
- package/lib/src/core-components/src/components/Divider/index.js +2 -0
- package/lib/src/core-components/src/components/Divider/types.d.ts +30 -0
- package/lib/src/core-components/src/components/Divider/types.d.ts.map +1 -0
- package/lib/src/core-components/src/components/Divider/types.js +4 -0
- package/lib/src/core-components/src/components/DynamicGrid/DynamicGrid.d.ts +6 -0
- package/lib/src/core-components/src/components/DynamicGrid/DynamicGrid.d.ts.map +1 -0
- package/lib/src/core-components/src/components/DynamicGrid/DynamicGrid.js +147 -0
- package/lib/src/core-components/src/components/DynamicGrid/GridContainer.d.ts +12 -0
- package/lib/src/core-components/src/components/DynamicGrid/GridContainer.d.ts.map +1 -0
- package/lib/src/core-components/src/components/DynamicGrid/GridContainer.js +89 -0
- package/lib/src/core-components/src/components/DynamicGrid/elements.d.ts +49 -0
- package/lib/src/core-components/src/components/DynamicGrid/elements.d.ts.map +1 -0
- package/lib/src/core-components/src/components/DynamicGrid/elements.js +409 -0
- package/lib/src/core-components/src/components/DynamicGrid/index.d.ts +4 -0
- package/lib/src/core-components/src/components/DynamicGrid/index.d.ts.map +1 -0
- package/lib/src/core-components/src/components/DynamicGrid/index.js +3 -0
- package/lib/src/core-components/src/components/DynamicGrid/types.d.ts +173 -0
- package/lib/src/core-components/src/components/DynamicGrid/types.d.ts.map +1 -0
- package/lib/src/core-components/src/components/DynamicGrid/types.js +28 -0
- package/lib/src/core-components/src/components/DynamicGrid/utils.d.ts +65 -0
- package/lib/src/core-components/src/components/DynamicGrid/utils.d.ts.map +1 -0
- package/lib/src/core-components/src/components/DynamicGrid/utils.js +193 -0
- package/lib/src/core-components/src/components/Icon/Icon.js +1 -1
- package/lib/src/core-components/src/components/Masonry/Masonry.d.ts +7 -0
- package/lib/src/core-components/src/components/Masonry/Masonry.d.ts.map +1 -0
- package/lib/src/core-components/src/components/Masonry/Masonry.js +73 -0
- package/lib/src/core-components/src/components/Masonry/elements.d.ts +31 -0
- package/lib/src/core-components/src/components/Masonry/elements.d.ts.map +1 -0
- package/lib/src/core-components/src/components/Masonry/elements.js +122 -0
- package/lib/src/core-components/src/components/Masonry/hooks.d.ts +21 -0
- package/lib/src/core-components/src/components/Masonry/hooks.d.ts.map +1 -0
- package/lib/src/core-components/src/components/Masonry/hooks.js +100 -0
- package/lib/src/core-components/src/components/Masonry/index.d.ts +4 -0
- package/lib/src/core-components/src/components/Masonry/index.d.ts.map +1 -0
- package/lib/src/core-components/src/components/Masonry/index.js +3 -0
- package/lib/src/core-components/src/components/Masonry/types.d.ts +117 -0
- package/lib/src/core-components/src/components/Masonry/types.d.ts.map +1 -0
- package/lib/src/core-components/src/components/Masonry/types.js +1 -0
- package/lib/src/core-components/src/components/Picker/color-picker-modal/color-picker-modal.component.js +1 -1
- package/lib/src/core-components/src/components/Skeleton/Skeleton.d.ts +8 -0
- package/lib/src/core-components/src/components/Skeleton/Skeleton.d.ts.map +1 -0
- package/lib/src/core-components/src/components/Skeleton/Skeleton.js +51 -0
- package/lib/src/core-components/src/components/Skeleton/elements.d.ts +33 -0
- package/lib/src/core-components/src/components/Skeleton/elements.d.ts.map +1 -0
- package/lib/src/core-components/src/components/Skeleton/elements.js +238 -0
- package/lib/src/core-components/src/components/Skeleton/index.d.ts +3 -0
- package/lib/src/core-components/src/components/Skeleton/index.d.ts.map +1 -0
- package/lib/src/core-components/src/components/Skeleton/index.js +2 -0
- package/lib/src/core-components/src/components/Skeleton/types.d.ts +80 -0
- package/lib/src/core-components/src/components/Skeleton/types.d.ts.map +1 -0
- package/lib/src/core-components/src/components/Skeleton/types.js +4 -0
- package/lib/src/core-components/src/components/SpeedDial/SpeedDial.d.ts +4 -0
- package/lib/src/core-components/src/components/SpeedDial/SpeedDial.d.ts.map +1 -0
- package/lib/src/core-components/src/components/SpeedDial/SpeedDial.js +128 -0
- package/lib/src/core-components/src/components/SpeedDial/elements.d.ts +57 -0
- package/lib/src/core-components/src/components/SpeedDial/elements.d.ts.map +1 -0
- package/lib/src/core-components/src/components/SpeedDial/elements.js +299 -0
- package/lib/src/core-components/src/components/SpeedDial/index.d.ts +3 -0
- package/lib/src/core-components/src/components/SpeedDial/index.d.ts.map +1 -0
- package/lib/src/core-components/src/components/SpeedDial/index.js +2 -0
- package/lib/src/core-components/src/components/SpeedDial/types.d.ts +149 -0
- package/lib/src/core-components/src/components/SpeedDial/types.d.ts.map +1 -0
- package/lib/src/core-components/src/components/SpeedDial/types.js +3 -0
- package/lib/src/core-components/src/components/Switch/Switch.d.ts +4 -0
- package/lib/src/core-components/src/components/Switch/Switch.d.ts.map +1 -0
- package/lib/src/core-components/src/components/Switch/Switch.js +26 -0
- package/lib/src/core-components/src/components/Switch/elements.d.ts +33 -0
- package/lib/src/core-components/src/components/Switch/elements.d.ts.map +1 -0
- package/lib/src/core-components/src/components/Switch/elements.js +167 -0
- package/lib/src/core-components/src/components/Switch/index.d.ts +3 -0
- package/lib/src/core-components/src/components/Switch/index.d.ts.map +1 -0
- package/lib/src/core-components/src/components/Switch/index.js +2 -0
- package/lib/src/core-components/src/components/Switch/types.d.ts +32 -0
- package/lib/src/core-components/src/components/Switch/types.d.ts.map +1 -0
- package/lib/src/core-components/src/components/Switch/types.js +3 -0
- package/lib/src/core-components/src/components/Table/Table.d.ts +7 -0
- package/lib/src/core-components/src/components/Table/Table.d.ts.map +1 -0
- package/lib/src/core-components/src/components/Table/Table.js +695 -0
- package/lib/src/core-components/src/components/Table/elements.d.ts +89 -0
- package/lib/src/core-components/src/components/Table/elements.d.ts.map +1 -0
- package/lib/src/core-components/src/components/Table/elements.js +611 -0
- package/lib/src/core-components/src/components/Table/filters.d.ts +23 -0
- package/lib/src/core-components/src/components/Table/filters.d.ts.map +1 -0
- package/lib/src/core-components/src/components/Table/filters.js +181 -0
- package/lib/src/core-components/src/components/Table/hooks.d.ts +107 -0
- package/lib/src/core-components/src/components/Table/hooks.d.ts.map +1 -0
- package/lib/src/core-components/src/components/Table/hooks.js +451 -0
- package/lib/src/core-components/src/components/Table/index.d.ts +5 -0
- package/lib/src/core-components/src/components/Table/index.d.ts.map +1 -0
- package/lib/src/core-components/src/components/Table/index.js +4 -0
- package/lib/src/core-components/src/components/Table/types.d.ts +635 -0
- package/lib/src/core-components/src/components/Table/types.d.ts.map +1 -0
- package/lib/src/core-components/src/components/Table/types.js +1 -0
- package/lib/src/core-components/src/components/Toast/Toast.d.ts +5 -0
- package/lib/src/core-components/src/components/Toast/Toast.d.ts.map +1 -0
- package/lib/src/core-components/src/components/Toast/Toast.js +50 -0
- package/lib/src/core-components/src/components/Toast/elements.d.ts +28 -0
- package/lib/src/core-components/src/components/Toast/elements.d.ts.map +1 -0
- package/lib/src/core-components/src/components/Toast/elements.js +272 -0
- package/lib/src/core-components/src/components/Toast/index.d.ts +3 -0
- package/lib/src/core-components/src/components/Toast/index.d.ts.map +1 -0
- package/lib/src/core-components/src/components/Toast/index.js +2 -0
- package/lib/src/core-components/src/components/Toast/types.d.ts +52 -0
- package/lib/src/core-components/src/components/Toast/types.d.ts.map +1 -0
- package/lib/src/core-components/src/components/Toast/types.js +9 -0
- package/lib/src/core-components/src/components/Tooltip/Tooltip.d.ts +7 -0
- package/lib/src/core-components/src/components/Tooltip/Tooltip.d.ts.map +1 -0
- package/lib/src/core-components/src/components/Tooltip/Tooltip.js +200 -0
- package/lib/src/core-components/src/components/Tooltip/elements.d.ts +19 -0
- package/lib/src/core-components/src/components/Tooltip/elements.d.ts.map +1 -0
- package/lib/src/core-components/src/components/Tooltip/elements.js +195 -0
- package/lib/src/core-components/src/components/Tooltip/index.d.ts +3 -0
- package/lib/src/core-components/src/components/Tooltip/index.d.ts.map +1 -0
- package/lib/src/core-components/src/components/Tooltip/index.js +2 -0
- package/lib/src/core-components/src/components/Tooltip/types.d.ts +81 -17
- package/lib/src/core-components/src/components/Tooltip/types.d.ts.map +1 -1
- package/lib/src/core-components/src/components/Tooltip/types.js +17 -1
- package/lib/src/core-components/src/components/Tooltip/utils.d.ts +26 -0
- package/lib/src/core-components/src/components/Tooltip/utils.d.ts.map +1 -0
- package/lib/src/core-components/src/components/Tooltip/utils.js +140 -0
- package/lib/src/core-components/src/components/TreeSelect/TreeSelect.d.ts +5 -0
- package/lib/src/core-components/src/components/TreeSelect/TreeSelect.d.ts.map +1 -0
- package/lib/src/core-components/src/components/TreeSelect/TreeSelect.js +303 -0
- package/lib/src/core-components/src/components/TreeSelect/elements.d.ts +74 -0
- package/lib/src/core-components/src/components/TreeSelect/elements.d.ts.map +1 -0
- package/lib/src/core-components/src/components/TreeSelect/elements.js +494 -0
- package/lib/src/core-components/src/components/TreeSelect/hooks.d.ts +57 -0
- package/lib/src/core-components/src/components/TreeSelect/hooks.d.ts.map +1 -0
- package/lib/src/core-components/src/components/TreeSelect/hooks.js +252 -0
- package/lib/src/core-components/src/components/TreeSelect/index.d.ts +4 -0
- package/lib/src/core-components/src/components/TreeSelect/index.d.ts.map +1 -0
- package/lib/src/core-components/src/components/TreeSelect/index.js +3 -0
- package/lib/src/core-components/src/components/TreeSelect/types.d.ts +205 -0
- package/lib/src/core-components/src/components/TreeSelect/types.d.ts.map +1 -0
- package/lib/src/core-components/src/components/TreeSelect/types.js +1 -0
- package/lib/src/core-components/src/components/index.d.ts +13 -1
- package/lib/src/core-components/src/components/index.d.ts.map +1 -1
- package/lib/src/core-components/src/components/index.js +14 -1
- package/lib/src/core-components/src/core-components/CoreButton/CoreButton.d.ts +2 -2
- package/lib/src/core-components/src/tc.global.css +14 -3
- package/lib/src/core-components/src/tc.module.css +2 -2
- package/package.json +1 -1
- package/lib/src/core-components/src/components/Tooltip/tooltip.component.d.ts +0 -29
- package/lib/src/core-components/src/components/Tooltip/tooltip.component.d.ts.map +0 -1
- package/lib/src/core-components/src/components/Tooltip/tooltip.component.js +0 -10
|
@@ -0,0 +1,695 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import React, { forwardRef, useState, useCallback, useMemo, useRef, } from 'react';
|
|
4
|
+
import { TableRoot, Toolbar, ToolbarGroup, SearchInput, ToolbarButton, TableWrapper, StyledTable, TableHeader, HeaderRow, HeaderCell, SortIcon, FilterRow, FilterCell, TableBody, TableRow, TableCell, Checkbox, ExpandButton, ExpandedRow, ExpandedCell, TableFooter, FooterRow, FooterCell, PaginationWrapper, PaginationInfo, PaginationControls, PageButton, PageSizeSelect, QuickJumper, EmptyState, LoadingOverlay, LoadingSpinner, EditableCell, CellEditor, ColumnTogglePanel, ColumnToggleHeader, ColumnToggleSearch, ColumnToggleList, ColumnToggleItem, } from './elements';
|
|
5
|
+
import { useSortState, useFilterState, usePaginationState, useRowSelection, useRowExpansion, useColumnVisibility, useTableDebounce, sortData, filterData, paginateData, getNestedValue, exportToCSV, } from './hooks';
|
|
6
|
+
import { getFilterComponent } from './filters';
|
|
7
|
+
// Icons
|
|
8
|
+
const SearchIcon = () => (_jsxs("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [_jsx("circle", { cx: "11", cy: "11", r: "8" }), _jsx("path", { d: "M21 21l-4.35-4.35", strokeLinecap: "round" })] }));
|
|
9
|
+
const SortUpIcon = () => (_jsx("svg", { viewBox: "0 0 10 10", fill: "currentColor", children: _jsx("path", { d: "M5 0L10 6H0L5 0z" }) }));
|
|
10
|
+
const SortDownIcon = () => (_jsx("svg", { viewBox: "0 0 10 10", fill: "currentColor", children: _jsx("path", { d: "M5 10L0 4h10L5 10z" }) }));
|
|
11
|
+
const ChevronLeftIcon = () => (_jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: _jsx("path", { d: "M15 18l-6-6 6-6", strokeLinecap: "round", strokeLinejoin: "round" }) }));
|
|
12
|
+
const ChevronRightIcon = () => (_jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: _jsx("path", { d: "M9 18l6-6-6-6", strokeLinecap: "round", strokeLinejoin: "round" }) }));
|
|
13
|
+
const ChevronsLeftIcon = () => (_jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: _jsx("path", { d: "M11 17l-5-5 5-5M18 17l-5-5 5-5", strokeLinecap: "round", strokeLinejoin: "round" }) }));
|
|
14
|
+
const ChevronsRightIcon = () => (_jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: _jsx("path", { d: "M13 7l5 5-5 5M6 7l5 5-5 5", strokeLinecap: "round", strokeLinejoin: "round" }) }));
|
|
15
|
+
const ExpandIcon = () => (_jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: _jsx("path", { d: "M9 18l6-6-6-6", strokeLinecap: "round", strokeLinejoin: "round" }) }));
|
|
16
|
+
const CloseIcon = () => (_jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: _jsx("path", { d: "M18 6L6 18M6 6l12 12", strokeLinecap: "round", strokeLinejoin: "round" }) }));
|
|
17
|
+
const FilterIcon = () => (_jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: _jsx("path", { d: "M22 3H2l8 9.46V19l4 2v-8.54L22 3z", strokeLinecap: "round", strokeLinejoin: "round" }) }));
|
|
18
|
+
const DownloadIcon = () => (_jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: _jsx("path", { d: "M21 15v4a2 2 0 01-2 2H5a2 2 0 01-2-2v-4M7 10l5 5 5-5M12 15V3", strokeLinecap: "round", strokeLinejoin: "round" }) }));
|
|
19
|
+
const ColumnsIcon = () => (_jsxs("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [_jsx("rect", { x: "3", y: "3", width: "7", height: "18", rx: "1" }), _jsx("rect", { x: "14", y: "3", width: "7", height: "18", rx: "1" })] }));
|
|
20
|
+
const EmptyIcon = () => (_jsxs("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", children: [_jsx("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2" }), _jsx("path", { d: "M3 9h18M9 3v18", strokeLinecap: "round" })] }));
|
|
21
|
+
const EditIcon = () => (_jsxs("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [_jsx("path", { d: "M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7", strokeLinecap: "round", strokeLinejoin: "round" }), _jsx("path", { d: "M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z", strokeLinecap: "round", strokeLinejoin: "round" })] }));
|
|
22
|
+
const DeleteIcon = () => (_jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: _jsx("path", { d: "M3 6h18M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2", strokeLinecap: "round", strokeLinejoin: "round" }) }));
|
|
23
|
+
const ViewIcon = () => (_jsxs("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [_jsx("path", { d: "M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z", strokeLinecap: "round", strokeLinejoin: "round" }), _jsx("circle", { cx: "12", cy: "12", r: "3" })] }));
|
|
24
|
+
const RefreshIcon = () => (_jsxs("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [_jsx("path", { d: "M23 4v6h-6M1 20v-6h6", strokeLinecap: "round", strokeLinejoin: "round" }), _jsx("path", { d: "M3.51 9a9 9 0 0114.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0020.49 15", strokeLinecap: "round", strokeLinejoin: "round" })] }));
|
|
25
|
+
const PrintIcon = () => (_jsxs("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [_jsx("path", { d: "M6 9V2h12v7M6 18H4a2 2 0 01-2-2v-5a2 2 0 012-2h16a2 2 0 012 2v5a2 2 0 01-2 2h-2", strokeLinecap: "round", strokeLinejoin: "round" }), _jsx("rect", { x: "6", y: "14", width: "12", height: "8" })] }));
|
|
26
|
+
const ErrorIcon = () => (_jsxs("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [_jsx("circle", { cx: "12", cy: "12", r: "10" }), _jsx("path", { d: "M12 8v4M12 16h.01", strokeLinecap: "round", strokeLinejoin: "round" })] }));
|
|
27
|
+
export const Table = forwardRef(function TableComponent(props, ref) {
|
|
28
|
+
const { id, data, columns, keyField = '_id', loading = false, loadingIndicator, pagination = true, paginationConfig, totalSize, remote = false, defaultSort, sort: controlledSort, filterable = false, defaultFilters, filters: controlledFilters, searchable = false, searchPlaceholder = 'Search...', defaultSearchValue = '', searchValue: controlledSearchValue, searchDebounce = 300, rowSelection, expandable, editMode = 'none', onCellEdit, exportable = false, exportFileName = 'table_export', columnToggle = false, bordered = true, striped = false, hover = true, compact = false, stickyHeader = false, maxHeight, rowClassName, rowStyle, classNames = {}, styles = {}, className, style, emptyText = 'No data available', onChange, onPageChange, onSortChange, onFilterChange, onSearch, onRowClick, onRowDoubleClick, onClearFilters, toolbar, hideToolbar = false, showFooter = false, caption,
|
|
29
|
+
// Quick configuration props
|
|
30
|
+
isDelete = false, isEditModify, isUpdate, isExport, isSelectRow, fileName, hideExcelSheet = false,
|
|
31
|
+
// Quick callbacks
|
|
32
|
+
onSelectedRow, onUpdateItem, onPageSizeChange, onFilter, clearAllFilter,
|
|
33
|
+
// Dynamic configuration
|
|
34
|
+
dynamicStylingFields, fieldTypeConfig,
|
|
35
|
+
// Action column
|
|
36
|
+
showActionColumn, actionColumnWidth = 100, actionColumnTitle = 'Actions', actionColumnPosition = 'last', actionColumnRender, onDelete, onEdit, onView, isView = false,
|
|
37
|
+
// Row number
|
|
38
|
+
showRowNumber = false, rowNumberWidth = 50, rowNumberTitle = '#', rowNumberRender,
|
|
39
|
+
// Toolbar customization
|
|
40
|
+
toolbarPosition = 'top', toolbarLeft, toolbarRight, toolbarCenter,
|
|
41
|
+
// Refresh
|
|
42
|
+
refreshable = false, onRefresh,
|
|
43
|
+
// Print
|
|
44
|
+
printable = false, onPrint,
|
|
45
|
+
// Size
|
|
46
|
+
size = 'medium',
|
|
47
|
+
// Error state
|
|
48
|
+
error, onRetry,
|
|
49
|
+
// Skeleton loading
|
|
50
|
+
skeletonLoading = false, skeletonRowCount = 5,
|
|
51
|
+
// Hide header
|
|
52
|
+
hideHeader = false,
|
|
53
|
+
// Highlighted rows
|
|
54
|
+
highlightedRowKeys = [], highlightRowStyle, highlightRowClassName,
|
|
55
|
+
// Events
|
|
56
|
+
onRowMouseEnter, onRowMouseLeave, onCellClick, onHeaderClick, ...rest } = props;
|
|
57
|
+
// Resolve aliases
|
|
58
|
+
const resolvedExportable = isExport ?? exportable;
|
|
59
|
+
const resolvedExportFileName = fileName ?? exportFileName;
|
|
60
|
+
const resolvedIsEdit = isEditModify ?? isUpdate ?? false;
|
|
61
|
+
const resolvedIsView = isView;
|
|
62
|
+
const resolvedShowActionColumn = showActionColumn ?? (isDelete || resolvedIsEdit || resolvedIsView);
|
|
63
|
+
// Handle isSelectRow shorthand
|
|
64
|
+
const resolvedRowSelection = isSelectRow
|
|
65
|
+
? {
|
|
66
|
+
mode: 'checkbox',
|
|
67
|
+
...rowSelection,
|
|
68
|
+
onChange: (keys, rows) => {
|
|
69
|
+
rowSelection?.onChange?.(keys, rows);
|
|
70
|
+
onSelectedRow?.(rows);
|
|
71
|
+
},
|
|
72
|
+
}
|
|
73
|
+
: rowSelection;
|
|
74
|
+
// Size configuration
|
|
75
|
+
const sizeConfig = {
|
|
76
|
+
small: { padding: '4px 8px', fontSize: '12px' },
|
|
77
|
+
medium: { padding: '8px 12px', fontSize: '14px' },
|
|
78
|
+
large: { padding: '12px 16px', fontSize: '16px' },
|
|
79
|
+
};
|
|
80
|
+
// Refs
|
|
81
|
+
const tableRef = useRef(null);
|
|
82
|
+
// State
|
|
83
|
+
const [internalSearchValue, setInternalSearchValue] = useState(defaultSearchValue);
|
|
84
|
+
const [columnToggleOpen, setColumnToggleOpen] = useState(false);
|
|
85
|
+
const [columnSearch, setColumnSearch] = useState('');
|
|
86
|
+
const [editingCell, setEditingCell] = useState(null);
|
|
87
|
+
const [editValue, setEditValue] = useState(null);
|
|
88
|
+
const searchValue = controlledSearchValue ?? internalSearchValue;
|
|
89
|
+
const debouncedSearchValue = useTableDebounce(searchValue, searchDebounce);
|
|
90
|
+
// Sort state
|
|
91
|
+
const { sort, handleSort } = useSortState(defaultSort, controlledSort);
|
|
92
|
+
// Filter state
|
|
93
|
+
const { filters, setFilter, clearFilters } = useFilterState(defaultFilters, controlledFilters);
|
|
94
|
+
// Pagination state
|
|
95
|
+
const { page, pageSize, totalPages, goToPage, goToNextPage, goToPrevPage, goToFirstPage, goToLastPage, changePageSize, } = usePaginationState(paginationConfig?.page || 0, paginationConfig?.pageSize || 10, totalSize ?? data.length);
|
|
96
|
+
// Row selection
|
|
97
|
+
const { selectedKeys, isSelected, toggleRow, toggleAll, isAllSelected, isIndeterminate, } = useRowSelection(data, rowSelection?.keyField || keyField, rowSelection?.mode || 'none', rowSelection?.selectedRowKeys, rowSelection?.getCheckboxProps);
|
|
98
|
+
// Row expansion
|
|
99
|
+
const { expandedKeys, isExpanded, toggleExpand } = useRowExpansion(expandable?.keyField || keyField, expandable?.defaultExpandedRowKeys, expandable?.expandedRowKeys, expandable?.accordion);
|
|
100
|
+
// Column visibility
|
|
101
|
+
const { visibleColumns, toggleColumn, isColumnHidden } = useColumnVisibility(columns, id);
|
|
102
|
+
// Process data (filter, sort, paginate)
|
|
103
|
+
const processedData = useMemo(() => {
|
|
104
|
+
if (remote) {
|
|
105
|
+
// Server-side processing - data is already processed
|
|
106
|
+
return data;
|
|
107
|
+
}
|
|
108
|
+
let result = [...data];
|
|
109
|
+
// Filter
|
|
110
|
+
result = filterData(result, filters, columns, debouncedSearchValue);
|
|
111
|
+
// Sort
|
|
112
|
+
result = sortData(result, sort, columns);
|
|
113
|
+
// Paginate
|
|
114
|
+
if (pagination) {
|
|
115
|
+
result = paginateData(result, page, pageSize);
|
|
116
|
+
}
|
|
117
|
+
return result;
|
|
118
|
+
}, [
|
|
119
|
+
data,
|
|
120
|
+
filters,
|
|
121
|
+
sort,
|
|
122
|
+
page,
|
|
123
|
+
pageSize,
|
|
124
|
+
debouncedSearchValue,
|
|
125
|
+
remote,
|
|
126
|
+
pagination,
|
|
127
|
+
columns,
|
|
128
|
+
]);
|
|
129
|
+
// Calculate total for client-side
|
|
130
|
+
const calculatedTotal = useMemo(() => {
|
|
131
|
+
if (remote)
|
|
132
|
+
return totalSize || data.length;
|
|
133
|
+
return filterData(data, filters, columns, debouncedSearchValue).length;
|
|
134
|
+
}, [data, filters, columns, debouncedSearchValue, remote, totalSize]);
|
|
135
|
+
// Handle search
|
|
136
|
+
const handleSearchChange = useCallback((value) => {
|
|
137
|
+
setInternalSearchValue(value);
|
|
138
|
+
onSearch?.(value);
|
|
139
|
+
onChange?.({ type: 'search', search: value });
|
|
140
|
+
}, [onSearch, onChange]);
|
|
141
|
+
// Handle sort
|
|
142
|
+
const handleSortClick = useCallback((column) => {
|
|
143
|
+
if (!column.sort)
|
|
144
|
+
return;
|
|
145
|
+
const newSort = handleSort(column.dataField, sort.order);
|
|
146
|
+
onSortChange?.(newSort);
|
|
147
|
+
onChange?.({ type: 'sort', sort: newSort });
|
|
148
|
+
}, [sort, handleSort, onSortChange, onChange]);
|
|
149
|
+
// Handle filter
|
|
150
|
+
const handleFilterChange = useCallback((field, value) => {
|
|
151
|
+
setFilter(field, value);
|
|
152
|
+
const newFilters = { ...filters, [field]: value };
|
|
153
|
+
onFilterChange?.(newFilters);
|
|
154
|
+
onFilter?.('filter', newFilters, page, pageSize);
|
|
155
|
+
onChange?.({ type: 'filter', filters: newFilters });
|
|
156
|
+
}, [filters, setFilter, onFilterChange, onChange]);
|
|
157
|
+
// Handle clear all filters
|
|
158
|
+
const handleClearFilters = useCallback(() => {
|
|
159
|
+
clearFilters();
|
|
160
|
+
setInternalSearchValue('');
|
|
161
|
+
onClearFilters?.();
|
|
162
|
+
clearAllFilter?.();
|
|
163
|
+
onFilterChange?.({});
|
|
164
|
+
onChange?.({ type: 'filter', filters: {} });
|
|
165
|
+
}, [clearFilters, onClearFilters, onFilterChange, onChange]);
|
|
166
|
+
// Handle page change
|
|
167
|
+
const handlePageChange = useCallback((newPage) => {
|
|
168
|
+
goToPage(newPage);
|
|
169
|
+
onPageChange?.(newPage, pageSize);
|
|
170
|
+
onPageSizeChange?.(newPage, pageSize);
|
|
171
|
+
onChange?.({ type: 'pagination', pagination: { page: newPage, pageSize } });
|
|
172
|
+
}, [goToPage, pageSize, onPageChange, onPageSizeChange, onChange]);
|
|
173
|
+
// Handle page size change
|
|
174
|
+
const handlePageSizeChange = useCallback((newSize) => {
|
|
175
|
+
changePageSize(newSize);
|
|
176
|
+
onPageChange?.(0, newSize);
|
|
177
|
+
onPageSizeChange?.(0, newSize);
|
|
178
|
+
onChange?.({
|
|
179
|
+
type: 'pagination',
|
|
180
|
+
pagination: { page: 0, pageSize: newSize },
|
|
181
|
+
});
|
|
182
|
+
}, [changePageSize, onPageChange, onChange]);
|
|
183
|
+
// Handle row click
|
|
184
|
+
const handleRowClick = useCallback((row, rowIndex, e) => {
|
|
185
|
+
// Selection handling
|
|
186
|
+
if (rowSelection?.mode && rowSelection.mode !== 'none') {
|
|
187
|
+
const result = toggleRow(row);
|
|
188
|
+
if (result) {
|
|
189
|
+
rowSelection.onChange?.(result.selectedKeys, result.selectedRows);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
// Expand by click
|
|
193
|
+
if (expandable?.expandRowByClick) {
|
|
194
|
+
const result = toggleExpand(row);
|
|
195
|
+
if (result) {
|
|
196
|
+
expandable.onExpandChange?.(result.expandedKeys, result.expanded, row);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
onRowClick?.(row, rowIndex, e);
|
|
200
|
+
}, [rowSelection, expandable, toggleRow, toggleExpand, onRowClick]);
|
|
201
|
+
// Helper to check if cell is editable and get custom editor
|
|
202
|
+
const getCellEditableInfo = useCallback((column, row, rowIndex, colIndex) => {
|
|
203
|
+
if (!column.editable) {
|
|
204
|
+
return { isEditable: false };
|
|
205
|
+
}
|
|
206
|
+
if (typeof column.editable === 'boolean') {
|
|
207
|
+
return { isEditable: column.editable };
|
|
208
|
+
}
|
|
209
|
+
// It's a function
|
|
210
|
+
const cellValue = getNestedValue(row, column.dataField);
|
|
211
|
+
const result = column.editable(cellValue, row, rowIndex, colIndex);
|
|
212
|
+
if (typeof result === 'boolean') {
|
|
213
|
+
return { isEditable: result };
|
|
214
|
+
}
|
|
215
|
+
// Result is a custom editor (ReactNode)
|
|
216
|
+
return { isEditable: true, customEditor: result };
|
|
217
|
+
}, []);
|
|
218
|
+
// Handle cell edit
|
|
219
|
+
const handleCellDoubleClick = useCallback((row, rowIndex, column, colIndex, e) => {
|
|
220
|
+
if (editMode === 'none')
|
|
221
|
+
return;
|
|
222
|
+
const { isEditable } = getCellEditableInfo(column, row, rowIndex, colIndex);
|
|
223
|
+
if (!isEditable)
|
|
224
|
+
return;
|
|
225
|
+
if (editMode === 'dblclick') {
|
|
226
|
+
setEditingCell({ row: rowIndex, field: column.dataField });
|
|
227
|
+
setEditValue(getNestedValue(row, column.dataField));
|
|
228
|
+
}
|
|
229
|
+
onRowDoubleClick?.(row, rowIndex, e);
|
|
230
|
+
}, [editMode, onRowDoubleClick, getCellEditableInfo]);
|
|
231
|
+
const handleCellClick = useCallback((row, rowIndex, column, colIndex) => {
|
|
232
|
+
if (editMode !== 'click')
|
|
233
|
+
return;
|
|
234
|
+
const { isEditable } = getCellEditableInfo(column, row, rowIndex, colIndex);
|
|
235
|
+
if (!isEditable)
|
|
236
|
+
return;
|
|
237
|
+
setEditingCell({ row: rowIndex, field: column.dataField });
|
|
238
|
+
setEditValue(getNestedValue(row, column.dataField));
|
|
239
|
+
}, [editMode, getCellEditableInfo]);
|
|
240
|
+
const handleCellEditComplete = useCallback((row, rowIndex, column) => {
|
|
241
|
+
if (editingCell) {
|
|
242
|
+
// Validate
|
|
243
|
+
if (column.validator) {
|
|
244
|
+
const result = column.validator(editValue, row);
|
|
245
|
+
if (result !== true) {
|
|
246
|
+
alert(typeof result === 'string' ? result : 'Invalid value');
|
|
247
|
+
setEditingCell(null);
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
const rowId = row[keyField];
|
|
252
|
+
onCellEdit?.(editValue, column.dataField, row, rowIndex);
|
|
253
|
+
onUpdateItem?.(editValue, column.dataField, rowId);
|
|
254
|
+
}
|
|
255
|
+
setEditingCell(null);
|
|
256
|
+
}, [editingCell, editValue, onCellEdit, onUpdateItem, keyField]);
|
|
257
|
+
// Helper to get nested value from object
|
|
258
|
+
const getNestedValueLocal = (obj, path) => {
|
|
259
|
+
return path.split('.').reduce((acc, key) => acc?.[key], obj);
|
|
260
|
+
};
|
|
261
|
+
// Process field value based on fieldTypeConfig (matching reference implementation)
|
|
262
|
+
const processFieldValue = useCallback((value, dataField, row) => {
|
|
263
|
+
const config = fieldTypeConfig?.[dataField];
|
|
264
|
+
const fieldType = config?.type || 'string';
|
|
265
|
+
switch (fieldType) {
|
|
266
|
+
case 'array':
|
|
267
|
+
if (config?.fields && config.fields.length > 0) {
|
|
268
|
+
// Array of objects with specific fields to extract
|
|
269
|
+
if (!Array.isArray(value))
|
|
270
|
+
return value || '';
|
|
271
|
+
return value
|
|
272
|
+
.slice(0, config.maxItems || value.length)
|
|
273
|
+
.map((item) => {
|
|
274
|
+
if (typeof item === 'object' && config.fields) {
|
|
275
|
+
// Extract only specified fields from the object
|
|
276
|
+
return config.fields
|
|
277
|
+
.map((field) => item[field])
|
|
278
|
+
.filter(Boolean)
|
|
279
|
+
.join(', ');
|
|
280
|
+
}
|
|
281
|
+
else if (typeof item === 'string') {
|
|
282
|
+
return item;
|
|
283
|
+
}
|
|
284
|
+
return '';
|
|
285
|
+
})
|
|
286
|
+
.filter(Boolean)
|
|
287
|
+
.join(config.separator || '; ');
|
|
288
|
+
}
|
|
289
|
+
else {
|
|
290
|
+
// Default array handling
|
|
291
|
+
if (!Array.isArray(value))
|
|
292
|
+
return value || '';
|
|
293
|
+
return value
|
|
294
|
+
.map((item) => typeof item === 'object' ? JSON.stringify(item) : item)
|
|
295
|
+
.join('; ');
|
|
296
|
+
}
|
|
297
|
+
case 'object':
|
|
298
|
+
if (!value || typeof value !== 'object')
|
|
299
|
+
return '';
|
|
300
|
+
const fields = config?.fields || config?.keys || [];
|
|
301
|
+
const labelMap = config?.labelMap || {};
|
|
302
|
+
if (fields.length > 0) {
|
|
303
|
+
// Extract specific fields with optional label mapping
|
|
304
|
+
return fields
|
|
305
|
+
.map((field) => {
|
|
306
|
+
const nestedValue = getNestedValueLocal(value, field);
|
|
307
|
+
if (nestedValue !== undefined && nestedValue !== null) {
|
|
308
|
+
const label = labelMap[field] || field;
|
|
309
|
+
return `${label}: ${nestedValue}`;
|
|
310
|
+
}
|
|
311
|
+
return null;
|
|
312
|
+
})
|
|
313
|
+
.filter(Boolean)
|
|
314
|
+
.join(', ');
|
|
315
|
+
}
|
|
316
|
+
else {
|
|
317
|
+
// Default object handling
|
|
318
|
+
return Object.entries(value)
|
|
319
|
+
.map(([key, val]) => typeof val === 'boolean'
|
|
320
|
+
? `${key}: ${val ? 'Yes' : 'No'}`
|
|
321
|
+
: `${key}: ${val}`)
|
|
322
|
+
.join(', ');
|
|
323
|
+
}
|
|
324
|
+
case 'date':
|
|
325
|
+
if (!value)
|
|
326
|
+
return '';
|
|
327
|
+
try {
|
|
328
|
+
const date = new Date(value);
|
|
329
|
+
const format = config?.dateFormat || 'YYYY-MM-DD HH:mm:ss';
|
|
330
|
+
// Simple date formatting
|
|
331
|
+
return date.toISOString().slice(0, 19).replace('T', ' ');
|
|
332
|
+
}
|
|
333
|
+
catch {
|
|
334
|
+
return String(value);
|
|
335
|
+
}
|
|
336
|
+
case 'number':
|
|
337
|
+
return value !== undefined && value !== null
|
|
338
|
+
? String(Number(value))
|
|
339
|
+
: '';
|
|
340
|
+
case 'boolean':
|
|
341
|
+
return typeof value === 'boolean' ? (value ? 'Yes' : 'No') : '';
|
|
342
|
+
case 'string':
|
|
343
|
+
case 'text':
|
|
344
|
+
default:
|
|
345
|
+
if (typeof value === 'boolean')
|
|
346
|
+
return value ? 'Yes' : 'No';
|
|
347
|
+
return value !== undefined && value !== null ? String(value) : '';
|
|
348
|
+
}
|
|
349
|
+
}, [fieldTypeConfig]);
|
|
350
|
+
// Handle export
|
|
351
|
+
const handleExport = useCallback(() => {
|
|
352
|
+
const exportData = remote
|
|
353
|
+
? data
|
|
354
|
+
: filterData(data, filters, columns, debouncedSearchValue);
|
|
355
|
+
// Filter columns based on hideExcelSheet array and csvExport !== false
|
|
356
|
+
let exportColumns = visibleColumns.filter((col) => col.csvExport !== false);
|
|
357
|
+
if (Array.isArray(hideExcelSheet)) {
|
|
358
|
+
exportColumns = exportColumns.filter((col) => !hideExcelSheet.includes(col.dataField));
|
|
359
|
+
}
|
|
360
|
+
// Also filter based on fieldTypeConfig hideFromExport or csvExport
|
|
361
|
+
if (fieldTypeConfig) {
|
|
362
|
+
exportColumns = exportColumns.filter((col) => {
|
|
363
|
+
const config = fieldTypeConfig[col.dataField];
|
|
364
|
+
if (config?.hideFromExport)
|
|
365
|
+
return false;
|
|
366
|
+
if (config?.csvExport === false)
|
|
367
|
+
return false;
|
|
368
|
+
return true;
|
|
369
|
+
});
|
|
370
|
+
}
|
|
371
|
+
// Create enhanced columns with export formatters
|
|
372
|
+
const enhancedColumns = exportColumns.map((col) => {
|
|
373
|
+
const config = fieldTypeConfig?.[col.dataField];
|
|
374
|
+
// If column already has csvFormatter, use it
|
|
375
|
+
if (col.csvFormatter) {
|
|
376
|
+
return col;
|
|
377
|
+
}
|
|
378
|
+
// If config has exportFormatter, use it
|
|
379
|
+
if (config?.exportFormatter) {
|
|
380
|
+
return { ...col, csvFormatter: config.exportFormatter };
|
|
381
|
+
}
|
|
382
|
+
// If config has type, create formatter based on type
|
|
383
|
+
if (config?.type) {
|
|
384
|
+
return {
|
|
385
|
+
...col,
|
|
386
|
+
csvFormatter: (cell, row) => processFieldValue(cell, col.dataField, row),
|
|
387
|
+
};
|
|
388
|
+
}
|
|
389
|
+
return col;
|
|
390
|
+
});
|
|
391
|
+
exportToCSV(exportData, enhancedColumns, resolvedExportFileName);
|
|
392
|
+
}, [
|
|
393
|
+
data,
|
|
394
|
+
filters,
|
|
395
|
+
columns,
|
|
396
|
+
debouncedSearchValue,
|
|
397
|
+
visibleColumns,
|
|
398
|
+
hideExcelSheet,
|
|
399
|
+
fieldTypeConfig,
|
|
400
|
+
processFieldValue,
|
|
401
|
+
resolvedExportFileName,
|
|
402
|
+
remote,
|
|
403
|
+
]);
|
|
404
|
+
// Handle checkbox change
|
|
405
|
+
const handleCheckboxChange = useCallback((row, e) => {
|
|
406
|
+
e.stopPropagation();
|
|
407
|
+
const result = toggleRow(row);
|
|
408
|
+
if (result) {
|
|
409
|
+
rowSelection?.onChange?.(result.selectedKeys, result.selectedRows);
|
|
410
|
+
}
|
|
411
|
+
}, [toggleRow, rowSelection]);
|
|
412
|
+
// Handle select all
|
|
413
|
+
const handleSelectAllChange = useCallback(() => {
|
|
414
|
+
const result = toggleAll(!isAllSelected);
|
|
415
|
+
if (result) {
|
|
416
|
+
rowSelection?.onChange?.(result.selectedKeys, result.selectedRows);
|
|
417
|
+
}
|
|
418
|
+
}, [toggleAll, isAllSelected, rowSelection]);
|
|
419
|
+
// Handle expand toggle
|
|
420
|
+
const handleExpandClick = useCallback((row, e) => {
|
|
421
|
+
e.stopPropagation();
|
|
422
|
+
const result = toggleExpand(row);
|
|
423
|
+
expandable?.onExpandChange?.(result.expandedKeys, result.expanded, row);
|
|
424
|
+
}, [toggleExpand, expandable]);
|
|
425
|
+
// Filtered column list for toggle panel
|
|
426
|
+
const filteredToggleColumns = useMemo(() => {
|
|
427
|
+
return columns.filter((c) => c.dataField !== keyField &&
|
|
428
|
+
c.text.toLowerCase().includes(columnSearch.toLowerCase()));
|
|
429
|
+
}, [columns, keyField, columnSearch]);
|
|
430
|
+
// Get row key
|
|
431
|
+
const getRowKey = useCallback((row) => row[keyField], [keyField]);
|
|
432
|
+
// Render cell content
|
|
433
|
+
const renderCellContent = useCallback((row, column, rowIndex, colIndex) => {
|
|
434
|
+
const value = getNestedValue(row, column.dataField);
|
|
435
|
+
const isEditing = editingCell?.row === rowIndex &&
|
|
436
|
+
editingCell?.field === column.dataField;
|
|
437
|
+
if (isEditing) {
|
|
438
|
+
// Check for custom editorRenderer
|
|
439
|
+
if (column.editorRenderer) {
|
|
440
|
+
const editorProps = {
|
|
441
|
+
value: editValue,
|
|
442
|
+
onUpdate: (newValue) => {
|
|
443
|
+
setEditValue(newValue);
|
|
444
|
+
handleCellEditComplete(row, rowIndex, column);
|
|
445
|
+
},
|
|
446
|
+
onCancel: () => setEditingCell(null),
|
|
447
|
+
onBlur: () => handleCellEditComplete(row, rowIndex, column),
|
|
448
|
+
row,
|
|
449
|
+
column,
|
|
450
|
+
rowIndex,
|
|
451
|
+
columnIndex: colIndex,
|
|
452
|
+
};
|
|
453
|
+
return column.editorRenderer(editorProps, editValue, row, column, rowIndex, colIndex);
|
|
454
|
+
}
|
|
455
|
+
// Default editor
|
|
456
|
+
return (_jsx(CellEditor, { type: column.editorType === 'number' ? 'number' : 'text', value: editValue ?? '', onChange: (e) => setEditValue(e.target.value), onBlur: () => handleCellEditComplete(row, rowIndex, column), onKeyDown: (e) => {
|
|
457
|
+
if (e.key === 'Enter') {
|
|
458
|
+
handleCellEditComplete(row, rowIndex, column);
|
|
459
|
+
}
|
|
460
|
+
if (e.key === 'Escape') {
|
|
461
|
+
setEditingCell(null);
|
|
462
|
+
}
|
|
463
|
+
}, className: column.editorClasses, style: column.editorStyle, autoFocus: true }));
|
|
464
|
+
}
|
|
465
|
+
if (column.formatter) {
|
|
466
|
+
return column.formatter(value, row, rowIndex, colIndex);
|
|
467
|
+
}
|
|
468
|
+
if (value === null || value === undefined)
|
|
469
|
+
return '';
|
|
470
|
+
if (typeof value === 'boolean')
|
|
471
|
+
return value ? 'Yes' : 'No';
|
|
472
|
+
if (typeof value === 'object')
|
|
473
|
+
return JSON.stringify(value);
|
|
474
|
+
return String(value);
|
|
475
|
+
}, [editingCell, editValue, handleCellEditComplete]);
|
|
476
|
+
// Render toolbar
|
|
477
|
+
const renderToolbar = () => {
|
|
478
|
+
if (hideToolbar)
|
|
479
|
+
return null;
|
|
480
|
+
if (typeof toolbar === 'function') {
|
|
481
|
+
return toolbar({
|
|
482
|
+
searchValue,
|
|
483
|
+
onSearch: handleSearchChange,
|
|
484
|
+
onClearFilters: handleClearFilters,
|
|
485
|
+
onExport: handleExport,
|
|
486
|
+
});
|
|
487
|
+
}
|
|
488
|
+
if (toolbar)
|
|
489
|
+
return toolbar;
|
|
490
|
+
const hasFilters = Object.keys(filters).length > 0 || searchValue;
|
|
491
|
+
return (_jsxs(Toolbar, { className: classNames.toolbar, style: styles.toolbar, children: [_jsxs(ToolbarGroup, { children: [toolbarLeft, searchable && (_jsxs(SearchInput, { children: [_jsx(SearchIcon, {}), _jsx("input", { type: "text", value: searchValue, onChange: (e) => handleSearchChange(e.target.value), placeholder: searchPlaceholder })] })), hasFilters && (_jsxs(ToolbarButton, { onClick: handleClearFilters, children: [_jsx(CloseIcon, {}), "Clear Filters"] }))] }), toolbarCenter, _jsxs(ToolbarGroup, { children: [refreshable && (_jsxs(ToolbarButton, { onClick: onRefresh, children: [_jsx(RefreshIcon, {}), "Refresh"] })), printable && (_jsxs(ToolbarButton, { onClick: onPrint, children: [_jsx(PrintIcon, {}), "Print"] })), resolvedExportable && hideExcelSheet !== true && (_jsxs(ToolbarButton, { onClick: handleExport, children: [_jsx(DownloadIcon, {}), "Export"] })), columnToggle && (_jsxs("div", { style: { position: 'relative' }, children: [_jsxs(ToolbarButton, { "$active": columnToggleOpen, onClick: () => setColumnToggleOpen(!columnToggleOpen), children: [_jsx(ColumnsIcon, {}), "Columns"] }), columnToggleOpen && (_jsxs(ColumnTogglePanel, { children: [_jsxs(ColumnToggleHeader, { children: [_jsx("span", { children: "Toggle Columns" }), _jsx("button", { onClick: () => setColumnToggleOpen(false), children: _jsx(CloseIcon, {}) })] }), _jsx(ColumnToggleSearch, { children: _jsx("input", { type: "text", value: columnSearch, onChange: (e) => setColumnSearch(e.target.value), placeholder: "Search columns..." }) }), _jsx(ColumnToggleList, { children: filteredToggleColumns.map((column) => (_jsxs(ColumnToggleItem, { children: [_jsx("input", { type: "checkbox", checked: !isColumnHidden(column.dataField), onChange: () => toggleColumn(column.dataField) }), _jsx("span", { children: column.text })] }, column.dataField))) })] }))] })), toolbarRight] })] }));
|
|
492
|
+
};
|
|
493
|
+
// Render pagination
|
|
494
|
+
const renderPagination = () => {
|
|
495
|
+
if (!pagination)
|
|
496
|
+
return null;
|
|
497
|
+
const actualTotalPages = Math.ceil(calculatedTotal / pageSize) || 1;
|
|
498
|
+
const startItem = page * pageSize + 1;
|
|
499
|
+
const endItem = Math.min((page + 1) * pageSize, calculatedTotal);
|
|
500
|
+
const showTotal = paginationConfig?.showTotal === true
|
|
501
|
+
? `Showing ${startItem} to ${endItem} of ${calculatedTotal} Results`
|
|
502
|
+
: typeof paginationConfig?.showTotal === 'function'
|
|
503
|
+
? paginationConfig.showTotal(calculatedTotal, [startItem, endItem])
|
|
504
|
+
: null;
|
|
505
|
+
// Generate page numbers
|
|
506
|
+
const getPageNumbers = () => {
|
|
507
|
+
const pages = [];
|
|
508
|
+
const maxVisible = 5;
|
|
509
|
+
if (actualTotalPages <= maxVisible) {
|
|
510
|
+
for (let i = 0; i < actualTotalPages; i++)
|
|
511
|
+
pages.push(i);
|
|
512
|
+
}
|
|
513
|
+
else {
|
|
514
|
+
if (page < 3) {
|
|
515
|
+
for (let i = 0; i < 4; i++)
|
|
516
|
+
pages.push(i);
|
|
517
|
+
pages.push('...');
|
|
518
|
+
pages.push(actualTotalPages - 1);
|
|
519
|
+
}
|
|
520
|
+
else if (page > actualTotalPages - 4) {
|
|
521
|
+
pages.push(0);
|
|
522
|
+
pages.push('...');
|
|
523
|
+
for (let i = actualTotalPages - 4; i < actualTotalPages; i++)
|
|
524
|
+
pages.push(i);
|
|
525
|
+
}
|
|
526
|
+
else {
|
|
527
|
+
pages.push(0);
|
|
528
|
+
pages.push('...');
|
|
529
|
+
for (let i = page - 1; i <= page + 1; i++)
|
|
530
|
+
pages.push(i);
|
|
531
|
+
pages.push('...');
|
|
532
|
+
pages.push(actualTotalPages - 1);
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
return pages;
|
|
536
|
+
};
|
|
537
|
+
return (_jsxs(PaginationWrapper, { className: classNames.pagination, style: styles.pagination, children: [_jsxs(ToolbarGroup, { children: [rowSelection?.mode === 'checkbox' && selectedKeys.size > 0 && (_jsxs(ToolbarButton, { onClick: () => {
|
|
538
|
+
const selectedRows = data.filter((row) => selectedKeys.has(getRowKey(row)));
|
|
539
|
+
rowSelection.onChange?.(Array.from(selectedKeys), selectedRows);
|
|
540
|
+
}, children: [selectedKeys.size, " Selected"] })), paginationConfig?.showSizeChanger !== false && (_jsx(PageSizeSelect, { value: pageSize, onChange: (e) => handlePageSizeChange(Number(e.target.value)), children: (paginationConfig?.pageSizeOptions || [10, 20, 30, 50]).map((size) => (_jsx("option", { value: size, children: size }, size))) }))] }), _jsxs(PaginationControls, { children: [_jsx(PageButton, { onClick: goToFirstPage, disabled: page === 0, children: _jsx(ChevronsLeftIcon, {}) }), _jsx(PageButton, { onClick: goToPrevPage, disabled: page === 0, children: _jsx(ChevronLeftIcon, {}) }), getPageNumbers().map((p, i) => typeof p === 'string' ? (_jsx("span", { style: { padding: '0 4px', color: 'white' }, children: p }, `ellipsis-${i}`)) : (_jsx(PageButton, { "$active": p === page, onClick: () => handlePageChange(p), children: p + 1 }, p))), _jsx(PageButton, { onClick: goToNextPage, disabled: page >= actualTotalPages - 1, children: _jsx(ChevronRightIcon, {}) }), _jsx(PageButton, { onClick: goToLastPage, disabled: page >= actualTotalPages - 1, children: _jsx(ChevronsRightIcon, {}) })] }), showTotal && _jsx(PaginationInfo, { children: showTotal }), paginationConfig?.showQuickJumper && (_jsxs(QuickJumper, { children: ["Go to", _jsx("input", { type: "number", min: 1, max: actualTotalPages, placeholder: "#", onKeyDown: (e) => {
|
|
541
|
+
if (e.key === 'Enter') {
|
|
542
|
+
const target = e.target;
|
|
543
|
+
const pageNum = parseInt(target.value, 10) - 1;
|
|
544
|
+
if (pageNum >= 0 && pageNum < actualTotalPages) {
|
|
545
|
+
handlePageChange(pageNum);
|
|
546
|
+
target.value = '';
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
} })] }))] }));
|
|
550
|
+
};
|
|
551
|
+
// Has any filter active
|
|
552
|
+
const hasFilters = filterable && columns.some((c) => c.filter !== false);
|
|
553
|
+
return (_jsxs(TableRoot, { ref: ref, "$bordered": bordered, "$compact": compact, className: className || classNames.root, style: { ...styles.root, ...style, position: 'relative' }, "aria-label": rest['aria-label'], "aria-labelledby": rest['aria-labelledby'], children: [loading && (_jsx(LoadingOverlay, { className: classNames.loading, style: styles.loading, children: loadingIndicator || _jsx(LoadingSpinner, {}) })), renderToolbar(), _jsx(TableWrapper, { "$maxHeight": maxHeight, "$stickyHeader": stickyHeader, className: classNames.wrapper, style: styles.wrapper, children: _jsxs(StyledTable, { ref: tableRef, "$striped": striped, "$hover": hover, "$compact": compact, role: "grid", children: [caption && _jsx("caption", { className: "sr-only", children: caption }), _jsxs(TableHeader, { "$sticky": stickyHeader, className: classNames.header, style: styles.header, children: [_jsxs(HeaderRow, { className: classNames.headerRow, style: styles.headerRow, children: [rowSelection?.mode === 'checkbox' && (_jsx(HeaderCell, { "$align": "center", "$sortable": false, "$compact": compact, "$width": rowSelection.columnWidth || 40, children: !rowSelection.hideSelectAll && (_jsx(Checkbox, { checked: isAllSelected, ref: (el) => {
|
|
554
|
+
if (el)
|
|
555
|
+
el.indeterminate = isIndeterminate;
|
|
556
|
+
}, onChange: handleSelectAllChange })) })), expandable && (_jsx(HeaderCell, { "$align": "center", "$sortable": false, "$compact": compact, "$width": expandable.columnWidth || 40 })), showRowNumber && (_jsx(HeaderCell, { "$align": "center", "$sortable": false, "$compact": compact, "$width": rowNumberWidth, children: rowNumberTitle })), visibleColumns.map((column, colIndex) => (_jsxs(HeaderCell, { "$align": column.headerAlign || column.align || 'left', "$sortable": !!column.sort, "$compact": compact, "$width": column.width, "$minWidth": column.minWidth, "$pinned": column.pinned, className: column.headerClasses || classNames.headerCell, style: typeof column.headerStyle === 'function'
|
|
557
|
+
? column.headerStyle(column)
|
|
558
|
+
: column.headerStyle || styles.headerCell, onClick: () => handleSortClick(column), role: "columnheader", "aria-sort": sort.field === column.dataField
|
|
559
|
+
? sort.order === 'asc'
|
|
560
|
+
? 'ascending'
|
|
561
|
+
: sort.order === 'desc'
|
|
562
|
+
? 'descending'
|
|
563
|
+
: 'none'
|
|
564
|
+
: undefined, children: [column.headerFormatter
|
|
565
|
+
? column.headerFormatter(column, colIndex)
|
|
566
|
+
: column.headerText || column.text, column.sort &&
|
|
567
|
+
(column.sortCaret ? (_jsx(SortIcon, { "$active": sort.field === column.dataField, "$direction": sort.field === column.dataField
|
|
568
|
+
? sort.order || undefined
|
|
569
|
+
: undefined, children: column.sortCaret(sort.field === column.dataField ? sort.order : null, column) })) : (_jsxs(SortIcon, { "$active": sort.field === column.dataField, "$direction": sort.field === column.dataField
|
|
570
|
+
? sort.order || undefined
|
|
571
|
+
: undefined, children: [_jsx(SortUpIcon, {}), _jsx(SortDownIcon, {})] })))] }, column.dataField))), resolvedShowActionColumn && (_jsx(HeaderCell, { "$align": "center", "$sortable": false, "$compact": compact, "$width": actionColumnWidth, children: "Actions" }))] }), hasFilters && (_jsxs(FilterRow, { children: [rowSelection?.mode === 'checkbox' && (_jsx(FilterCell, { "$compact": compact })), expandable && _jsx(FilterCell, { "$compact": compact }), showRowNumber && _jsx(FilterCell, { "$compact": compact }), visibleColumns.map((column) => {
|
|
572
|
+
const FilterComponent = column.filterComponent ||
|
|
573
|
+
getFilterComponent(column.filterType || 'text');
|
|
574
|
+
const onFilter = (value) => handleFilterChange(column.dataField, value);
|
|
575
|
+
return (_jsx(FilterCell, { "$compact": compact, children: column.filter !== false && (column.filterRenderer ? (column.filterRenderer(onFilter, column)) : (_jsx(FilterComponent, { column: column, value: filters[column.dataField], onChange: onFilter, onClear: () => handleFilterChange(column.dataField, null) }))) }, column.dataField));
|
|
576
|
+
}), resolvedShowActionColumn && (_jsx(FilterCell, { "$compact": compact }))] }))] }), _jsx(TableBody, { className: classNames.body, style: styles.body, children: processedData.length === 0 ? (_jsx("tr", { children: _jsx("td", { colSpan: visibleColumns.length +
|
|
577
|
+
(rowSelection?.mode === 'checkbox' ? 1 : 0) +
|
|
578
|
+
(expandable ? 1 : 0) +
|
|
579
|
+
(showRowNumber ? 1 : 0) +
|
|
580
|
+
(resolvedShowActionColumn ? 1 : 0), children: _jsxs(EmptyState, { className: classNames.empty, style: styles.empty, children: [_jsx(EmptyIcon, {}), _jsx("span", { children: emptyText })] }) }) })) : (processedData.map((row, rowIndex) => {
|
|
581
|
+
const rowKey = getRowKey(row);
|
|
582
|
+
const rowSelected = isSelected(rowKey);
|
|
583
|
+
const rowExpanded = isExpanded(rowKey);
|
|
584
|
+
const checkboxProps = rowSelection?.getCheckboxProps?.(row);
|
|
585
|
+
const isExpandable = expandable?.rowExpandable?.(row) ?? true;
|
|
586
|
+
const rowClass = typeof rowClassName === 'function'
|
|
587
|
+
? rowClassName(row, rowIndex)
|
|
588
|
+
: rowClassName;
|
|
589
|
+
const rowStyles = typeof rowStyle === 'function'
|
|
590
|
+
? rowStyle(row, rowIndex)
|
|
591
|
+
: rowStyle;
|
|
592
|
+
const selectedStyle = rowSelected
|
|
593
|
+
? typeof rowSelection?.selectedRowStyle === 'function'
|
|
594
|
+
? rowSelection.selectedRowStyle(row)
|
|
595
|
+
: rowSelection?.selectedRowStyle
|
|
596
|
+
: undefined;
|
|
597
|
+
return (_jsxs(React.Fragment, { children: [_jsxs(TableRow, { "$selected": rowSelected, "$clickable": !!onRowClick ||
|
|
598
|
+
rowSelection?.mode === 'single' ||
|
|
599
|
+
expandable?.expandRowByClick === true, "$disabled": !!checkboxProps?.disabled, className: `${classNames.row || ''} ${rowClass || ''} ${rowSelected
|
|
600
|
+
? typeof rowSelection?.selectedRowClassName ===
|
|
601
|
+
'function'
|
|
602
|
+
? rowSelection.selectedRowClassName(row)
|
|
603
|
+
: rowSelection?.selectedRowClassName || ''
|
|
604
|
+
: ''}`, style: { ...styles.row, ...rowStyles, ...selectedStyle }, onClick: (e) => handleRowClick(row, rowIndex, e), onDoubleClick: (e) => handleCellDoubleClick(row, rowIndex, visibleColumns[0], 0, e), role: "row", "aria-selected": rowSelected, children: [rowSelection?.mode === 'checkbox' && (_jsx(TableCell, { "$align": "center", "$compact": compact, children: _jsx(Checkbox, { checked: rowSelected, disabled: checkboxProps?.disabled, onChange: (e) => handleCheckboxChange(row, e), onClick: (e) => e.stopPropagation() }) })), expandable && (_jsx(TableCell, { "$align": "center", "$compact": compact, children: isExpandable && (_jsx(ExpandButton, { "$expanded": rowExpanded, onClick: (e) => handleExpandClick(row, e), children: expandable.expandIcon ? (expandable.expandIcon({
|
|
605
|
+
expanded: rowExpanded,
|
|
606
|
+
row,
|
|
607
|
+
onExpand: () => toggleExpand(row),
|
|
608
|
+
})) : (_jsx(ExpandIcon, {})) })) })), showRowNumber && (_jsx(TableCell, { "$align": "center", "$compact": compact, style: {
|
|
609
|
+
width: rowNumberWidth,
|
|
610
|
+
color: '#6b7280',
|
|
611
|
+
fontWeight: 500,
|
|
612
|
+
}, children: rowNumberRender
|
|
613
|
+
? rowNumberRender(rowIndex + 1, row)
|
|
614
|
+
: rowIndex + 1 + page * pageSize })), visibleColumns.map((column, colIndex) => {
|
|
615
|
+
const cellClass = typeof column.classes === 'function'
|
|
616
|
+
? column.classes(getNestedValue(row, column.dataField), row, rowIndex, colIndex)
|
|
617
|
+
: column.classes;
|
|
618
|
+
const cellStyle = typeof column.style === 'function'
|
|
619
|
+
? column.style(getNestedValue(row, column.dataField), row, rowIndex, colIndex)
|
|
620
|
+
: column.style;
|
|
621
|
+
return (_jsx(TableCell, { "$align": column.align || 'left', "$compact": compact, "$pinned": column.pinned, className: cellClass || classNames.cell, style: { ...styles.cell, ...cellStyle }, onClick: () => handleCellClick(row, rowIndex, column, colIndex), onDoubleClick: (e) => handleCellDoubleClick(row, rowIndex, column, colIndex, e), role: "gridcell", children: (() => {
|
|
622
|
+
const editInfo = getCellEditableInfo(column, row, rowIndex, colIndex);
|
|
623
|
+
if (editInfo.isEditable &&
|
|
624
|
+
editMode !== 'none') {
|
|
625
|
+
// Check for custom editor
|
|
626
|
+
if (editInfo.customEditor) {
|
|
627
|
+
return editInfo.customEditor;
|
|
628
|
+
}
|
|
629
|
+
return (_jsx(EditableCell, { "$editing": editingCell?.row === rowIndex &&
|
|
630
|
+
editingCell?.field === column.dataField, children: renderCellContent(row, column, rowIndex, colIndex) }));
|
|
631
|
+
}
|
|
632
|
+
return renderCellContent(row, column, rowIndex, colIndex);
|
|
633
|
+
})() }, column.dataField));
|
|
634
|
+
}), resolvedShowActionColumn && (_jsx(TableCell, { "$align": "center", "$compact": compact, style: {
|
|
635
|
+
width: actionColumnWidth,
|
|
636
|
+
whiteSpace: 'nowrap',
|
|
637
|
+
}, children: actionColumnRender ? (actionColumnRender(row, rowIndex)) : (_jsxs("div", { style: {
|
|
638
|
+
display: 'flex',
|
|
639
|
+
gap: '4px',
|
|
640
|
+
justifyContent: 'center',
|
|
641
|
+
}, children: [resolvedIsView && (_jsx("button", { onClick: (e) => {
|
|
642
|
+
e.stopPropagation();
|
|
643
|
+
onView?.(row, rowIndex);
|
|
644
|
+
}, style: {
|
|
645
|
+
padding: '4px 8px',
|
|
646
|
+
background: '#10b981',
|
|
647
|
+
color: 'white',
|
|
648
|
+
border: 'none',
|
|
649
|
+
borderRadius: '4px',
|
|
650
|
+
cursor: 'pointer',
|
|
651
|
+
display: 'flex',
|
|
652
|
+
alignItems: 'center',
|
|
653
|
+
gap: '4px',
|
|
654
|
+
fontSize: '12px',
|
|
655
|
+
}, title: "View", children: _jsx(ViewIcon, {}) })), resolvedIsEdit && (_jsx("button", { onClick: (e) => {
|
|
656
|
+
e.stopPropagation();
|
|
657
|
+
onEdit?.(row, rowIndex);
|
|
658
|
+
}, style: {
|
|
659
|
+
padding: '4px 8px',
|
|
660
|
+
background: '#3b82f6',
|
|
661
|
+
color: 'white',
|
|
662
|
+
border: 'none',
|
|
663
|
+
borderRadius: '4px',
|
|
664
|
+
cursor: 'pointer',
|
|
665
|
+
display: 'flex',
|
|
666
|
+
alignItems: 'center',
|
|
667
|
+
gap: '4px',
|
|
668
|
+
fontSize: '12px',
|
|
669
|
+
}, title: "Edit", children: _jsx(EditIcon, {}) })), isDelete && (_jsx("button", { onClick: (e) => {
|
|
670
|
+
e.stopPropagation();
|
|
671
|
+
onDelete?.(row, rowIndex);
|
|
672
|
+
}, style: {
|
|
673
|
+
padding: '4px 8px',
|
|
674
|
+
background: '#ef4444',
|
|
675
|
+
color: 'white',
|
|
676
|
+
border: 'none',
|
|
677
|
+
borderRadius: '4px',
|
|
678
|
+
cursor: 'pointer',
|
|
679
|
+
display: 'flex',
|
|
680
|
+
alignItems: 'center',
|
|
681
|
+
gap: '4px',
|
|
682
|
+
fontSize: '12px',
|
|
683
|
+
}, title: "Delete", children: _jsx(DeleteIcon, {}) }))] })) }))] }), expandable && rowExpanded && isExpandable && (_jsx(ExpandedRow, { children: _jsx(ExpandedCell, { colSpan: visibleColumns.length +
|
|
684
|
+
(rowSelection?.mode === 'checkbox' ? 1 : 0) +
|
|
685
|
+
(expandable ? 1 : 0) +
|
|
686
|
+
(showRowNumber ? 1 : 0) +
|
|
687
|
+
(resolvedShowActionColumn ? 1 : 0), children: expandable.expandedRowRender?.(row, rowIndex, rowExpanded) }) }))] }, rowKey));
|
|
688
|
+
})) }), showFooter && (_jsx(TableFooter, { className: classNames.footer, style: styles.footer, children: _jsxs(FooterRow, { className: classNames.footerRow, style: styles.footerRow, children: [rowSelection?.mode === 'checkbox' && (_jsx(FooterCell, { "$align": "center", "$compact": compact })), expandable && (_jsx(FooterCell, { "$align": "center", "$compact": compact })), showRowNumber && (_jsx(FooterCell, { "$align": "center", "$compact": compact })), visibleColumns.map((column) => (_jsx(FooterCell, { "$align": column.align || 'left', "$compact": compact, className: classNames.footerCell, style: styles.footerCell, children: typeof column.footer === 'function'
|
|
689
|
+
? column.footer(column, data)
|
|
690
|
+
: column.footerFormatter
|
|
691
|
+
? column.footerFormatter(column, data)
|
|
692
|
+
: column.footer }, column.dataField))), resolvedShowActionColumn && (_jsx(FooterCell, { "$align": "center", "$compact": compact }))] }) }))] }) }), renderPagination()] }));
|
|
693
|
+
});
|
|
694
|
+
Table.displayName = 'Table';
|
|
695
|
+
export default Table;
|