@wallarm-org/design-system 0.45.0 → 0.45.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.
|
|
3
|
-
"generatedAt": "2026-05-
|
|
2
|
+
"version": "0.45.0",
|
|
3
|
+
"generatedAt": "2026-05-25T13:51:20.876Z",
|
|
4
4
|
"components": [
|
|
5
5
|
{
|
|
6
6
|
"name": "Accordion",
|
|
@@ -49188,6 +49188,12 @@
|
|
|
49188
49188
|
"type": "TableSortingState | undefined",
|
|
49189
49189
|
"required": false
|
|
49190
49190
|
},
|
|
49191
|
+
{
|
|
49192
|
+
"name": "manualSorting",
|
|
49193
|
+
"type": "boolean | undefined",
|
|
49194
|
+
"required": false,
|
|
49195
|
+
"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`)."
|
|
49196
|
+
},
|
|
49191
49197
|
{
|
|
49192
49198
|
"name": "rowSelection",
|
|
49193
49199
|
"type": "TableRowSelectionState | undefined",
|
|
@@ -49339,6 +49345,10 @@
|
|
|
49339
49345
|
"name": "Sorting",
|
|
49340
49346
|
"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}"
|
|
49341
49347
|
},
|
|
49348
|
+
{
|
|
49349
|
+
"name": "ManualSorting",
|
|
49350
|
+
"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}"
|
|
49351
|
+
},
|
|
49342
49352
|
{
|
|
49343
49353
|
"name": "LoadingState",
|
|
49344
49354
|
"code": "() => (\n <Table data={[]} columns={securityColumns} isLoading />\n)"
|