@wallarm-org/design-system 0.44.1 → 0.44.2-rc-fix-WDS-125-table-sorting.1
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.
|
@@ -8,7 +8,7 @@ import { useTableState } from "../hooks/index.js";
|
|
|
8
8
|
import { TABLE_EXPAND_COLUMN_ID, TABLE_MIN_COLUMN_WIDTH, TABLE_SELECT_COLUMN_ID, TABLE_SKELETON_ROWS, TABLE_VIRTUALIZATION_OVERSCAN, createExpandColumn, createSelectionColumn } from "../lib/index.js";
|
|
9
9
|
import { TableContext } from "./TableContext.js";
|
|
10
10
|
const TableProvider = (props)=>{
|
|
11
|
-
const { data, columns, isLoading = false, skeletonCount = TABLE_SKELETON_ROWS, children, getRowId, sorting: sortingProp, onSortingChange, rowSelection: rowSelectionProp, onRowSelectionChange, columnSizing: columnSizingProp, onColumnSizingChange, columnPinning: columnPinningProp, onColumnPinningChange, columnOrder: columnOrderProp, onColumnOrderChange, grouping: groupingProp, onGroupingChange, expanded: expandedProp, onExpandedChange, renderGroupRow, getSubRows, renderExpandedRow, columnVisibility: columnVisibilityProp, onColumnVisibilityChange, defaultColumnVisibility, defaultColumnOrder, virtualized, estimateRowHeight, overscan = TABLE_VIRTUALIZATION_OVERSCAN, onEndReached, onEndReachedThreshold, onMasterCellClick, activeRowId: activeRowIdProp } = props;
|
|
11
|
+
const { data, columns, isLoading = false, skeletonCount = TABLE_SKELETON_ROWS, children, getRowId, sorting: sortingProp, onSortingChange, manualSorting = false, rowSelection: rowSelectionProp, onRowSelectionChange, columnSizing: columnSizingProp, onColumnSizingChange, columnPinning: columnPinningProp, onColumnPinningChange, columnOrder: columnOrderProp, onColumnOrderChange, grouping: groupingProp, onGroupingChange, expanded: expandedProp, onExpandedChange, renderGroupRow, getSubRows, renderExpandedRow, columnVisibility: columnVisibilityProp, onColumnVisibilityChange, defaultColumnVisibility, defaultColumnOrder, virtualized, estimateRowHeight, overscan = TABLE_VIRTUALIZATION_OVERSCAN, onEndReached, onEndReachedThreshold, onMasterCellClick, activeRowId: activeRowIdProp } = props;
|
|
12
12
|
const masterCellActiveRowId = activeRowIdProp ?? null;
|
|
13
13
|
const sortingEnabled = !!onSortingChange;
|
|
14
14
|
const selectionEnabled = !!onRowSelectionChange;
|
|
@@ -131,9 +131,10 @@ const TableProvider = (props)=>{
|
|
|
131
131
|
getRowId,
|
|
132
132
|
getSubRows,
|
|
133
133
|
getCoreRowModel: getCoreRowModel(),
|
|
134
|
-
...sortingEnabled && {
|
|
134
|
+
...sortingEnabled && !manualSorting && {
|
|
135
135
|
getSortedRowModel: getSortedRowModel()
|
|
136
136
|
},
|
|
137
|
+
manualSorting,
|
|
137
138
|
...groupingEnabled && {
|
|
138
139
|
getGroupedRowModel: getGroupedRowModel()
|
|
139
140
|
},
|
|
@@ -155,6 +155,15 @@ export interface TableProps<T> extends TestableProps {
|
|
|
155
155
|
className?: string;
|
|
156
156
|
sorting?: TableSortingState;
|
|
157
157
|
onSortingChange?: TableOnChangeFn<TableSortingState>;
|
|
158
|
+
/**
|
|
159
|
+
* When `true`, disables TanStack's client-side sort. The table renders rows
|
|
160
|
+
* in the order they appear in `data` and only fires `onSortingChange` on
|
|
161
|
+
* header clicks. Use this when sorting is performed server-side and the
|
|
162
|
+
* server returns pre-sorted rows.
|
|
163
|
+
*
|
|
164
|
+
* Default: `false` (client-side sort via TanStack's `getSortedRowModel`).
|
|
165
|
+
*/
|
|
166
|
+
manualSorting?: boolean;
|
|
158
167
|
rowSelection?: TableRowSelectionState;
|
|
159
168
|
onRowSelectionChange?: TableOnChangeFn<TableRowSelectionState>;
|
|
160
169
|
columnSizing?: TableColumnSizingState;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.44.
|
|
3
|
-
"generatedAt": "2026-05-
|
|
2
|
+
"version": "0.44.1",
|
|
3
|
+
"generatedAt": "2026-05-25T13:37:58.453Z",
|
|
4
4
|
"components": [
|
|
5
5
|
{
|
|
6
6
|
"name": "Accordion",
|
|
@@ -48812,6 +48812,12 @@
|
|
|
48812
48812
|
"type": "TableSortingState | undefined",
|
|
48813
48813
|
"required": false
|
|
48814
48814
|
},
|
|
48815
|
+
{
|
|
48816
|
+
"name": "manualSorting",
|
|
48817
|
+
"type": "boolean | undefined",
|
|
48818
|
+
"required": false,
|
|
48819
|
+
"description": "When `true`, disables TanStack's client-side sort. The table renders rows\nin the order they appear in `data` and only fires `onSortingChange` on\nheader clicks. Use this when sorting is performed server-side and the\nserver returns pre-sorted rows.\n\nDefault: `false` (client-side sort via TanStack's `getSortedRowModel`)."
|
|
48820
|
+
},
|
|
48815
48821
|
{
|
|
48816
48822
|
"name": "rowSelection",
|
|
48817
48823
|
"type": "TableRowSelectionState | undefined",
|
|
@@ -48963,6 +48969,10 @@
|
|
|
48963
48969
|
"name": "Sorting",
|
|
48964
48970
|
"code": "() => {\n const [sorting, setSorting] = useState<TableSortingState>([]);\n\n return (\n <Table\n data={securityEvents}\n columns={securityColumns}\n getRowId={row => row.id}\n sorting={sorting}\n onSortingChange={setSorting}\n />\n );\n}"
|
|
48965
48971
|
},
|
|
48972
|
+
{
|
|
48973
|
+
"name": "ManualSorting",
|
|
48974
|
+
"code": "() => {\n const [sorting, setSorting] = useState<TableSortingState>([]);\n const data = useMemo(() => sortSecurityEvents(sorting), [sorting]);\n\n return (\n <Table\n data={data}\n columns={securityColumns}\n getRowId={row => row.id}\n sorting={sorting}\n onSortingChange={setSorting}\n manualSorting\n data-testid='manual-sort-table'\n />\n );\n}"
|
|
48975
|
+
},
|
|
48966
48976
|
{
|
|
48967
48977
|
"name": "LoadingState",
|
|
48968
48978
|
"code": "() => (\n <Table data={[]} columns={securityColumns} isLoading />\n)"
|
package/package.json
CHANGED