@tanstack/table-core 8.10.6 → 8.11.0
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/build/lib/columnHelper.js +1 -0
- package/build/lib/columnHelper.js.map +1 -1
- package/build/lib/features/ColumnSizing.d.ts +8 -1
- package/build/lib/features/ColumnSizing.js +3 -1
- package/build/lib/features/ColumnSizing.js.map +1 -1
- package/build/lib/features/Filters.js +0 -1
- package/build/lib/features/Filters.js.map +1 -1
- package/build/lib/features/RowSelection.d.ts +2 -2
- package/build/lib/features/RowSelection.js +0 -1
- package/build/lib/features/RowSelection.js.map +1 -1
- package/build/lib/index.esm.js +4 -15
- package/build/lib/index.esm.js.map +1 -1
- package/build/lib/index.mjs +4 -15
- package/build/lib/index.mjs.map +1 -1
- package/build/lib/sortingFns.js +0 -10
- package/build/lib/sortingFns.js.map +1 -1
- package/build/lib/utils/getGroupedRowModel.js +0 -2
- package/build/lib/utils/getGroupedRowModel.js.map +1 -1
- package/build/umd/index.development.js +4 -15
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +1 -1
- package/build/umd/index.production.js.map +1 -1
- package/package.json +1 -1
- package/src/features/ColumnSizing.ts +12 -2
- package/src/features/RowSelection.ts +2 -2
- package/src/sortingFns.ts +0 -10
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/table-core",
|
|
3
3
|
"author": "Tanner Linsley",
|
|
4
|
-
"version": "8.
|
|
4
|
+
"version": "8.11.0",
|
|
5
5
|
"description": "Headless UI for building powerful tables & datagrids for TS/JS.",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://github.com/tanstack/table#readme",
|
|
@@ -23,6 +23,8 @@ export interface ColumnSizingInfoState {
|
|
|
23
23
|
|
|
24
24
|
export type ColumnResizeMode = 'onChange' | 'onEnd'
|
|
25
25
|
|
|
26
|
+
export type ColumnResizeDirection = 'ltr' | 'rtl'
|
|
27
|
+
|
|
26
28
|
export interface ColumnSizingOptions {
|
|
27
29
|
/**
|
|
28
30
|
* Determines when the columnSizing state is updated. `onChange` updates the state when the user is dragging the resize handle. `onEnd` updates the state when the user releases the resize handle.
|
|
@@ -36,6 +38,12 @@ export interface ColumnSizingOptions {
|
|
|
36
38
|
* @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)
|
|
37
39
|
*/
|
|
38
40
|
enableColumnResizing?: boolean
|
|
41
|
+
/**
|
|
42
|
+
* Enables or disables right-to-left support for resizing the column. defaults to 'ltr'.
|
|
43
|
+
* @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#rtl)
|
|
44
|
+
* @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)
|
|
45
|
+
*/
|
|
46
|
+
columnResizeDirection?: ColumnResizeDirection
|
|
39
47
|
/**
|
|
40
48
|
* If provided, this function will be called with an `updaterFn` when `state.columnSizing` changes. This overrides the default internal state management, so you will also need to supply `state.columnSizing` from your own managed state.
|
|
41
49
|
* @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#oncolumnsizingchange)
|
|
@@ -52,7 +60,7 @@ export interface ColumnSizingOptions {
|
|
|
52
60
|
|
|
53
61
|
export type ColumnSizingDefaultOptions = Pick<
|
|
54
62
|
ColumnSizingOptions,
|
|
55
|
-
'columnResizeMode' | 'onColumnSizingChange' | 'onColumnSizingInfoChange'
|
|
63
|
+
'columnResizeMode' | 'onColumnSizingChange' | 'onColumnSizingInfoChange' | 'columnResizeDirection'
|
|
56
64
|
>
|
|
57
65
|
|
|
58
66
|
export interface ColumnSizingInstance {
|
|
@@ -225,6 +233,7 @@ export const ColumnSizing: TableFeature = {
|
|
|
225
233
|
): ColumnSizingDefaultOptions => {
|
|
226
234
|
return {
|
|
227
235
|
columnResizeMode: 'onEnd',
|
|
236
|
+
columnResizeDirection: 'ltr',
|
|
228
237
|
onColumnSizingChange: makeStateUpdater('columnSizing', table),
|
|
229
238
|
onColumnSizingInfoChange: makeStateUpdater('columnSizingInfo', table),
|
|
230
239
|
}
|
|
@@ -346,7 +355,8 @@ export const ColumnSizing: TableFeature = {
|
|
|
346
355
|
}
|
|
347
356
|
|
|
348
357
|
table.setColumnSizingInfo(old => {
|
|
349
|
-
const
|
|
358
|
+
const deltaDirection = table.options.columnResizeDirection === 'rtl' ? -1 : 1
|
|
359
|
+
const deltaOffset = (clientXPos - (old?.startOffset ?? 0)) * deltaDirection
|
|
350
360
|
const deltaPercentage = Math.max(
|
|
351
361
|
deltaOffset / (old?.startSize ?? 0),
|
|
352
362
|
-0.999999
|
|
@@ -126,13 +126,13 @@ export interface RowSelectionInstance<TData extends RowData> {
|
|
|
126
126
|
*/
|
|
127
127
|
getIsAllRowsSelected: () => boolean
|
|
128
128
|
/**
|
|
129
|
-
* Returns whether or not
|
|
129
|
+
* Returns whether or not any rows on the current page are selected.
|
|
130
130
|
* @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getissomepagerowsselected)
|
|
131
131
|
* @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)
|
|
132
132
|
*/
|
|
133
133
|
getIsSomePageRowsSelected: () => boolean
|
|
134
134
|
/**
|
|
135
|
-
* Returns whether or not
|
|
135
|
+
* Returns whether or not any rows in the table are selected.
|
|
136
136
|
* @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getissomerowsselected)
|
|
137
137
|
* @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)
|
|
138
138
|
*/
|
package/src/sortingFns.ts
CHANGED
|
@@ -55,9 +55,6 @@ function compareBasic(a: any, b: any) {
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
function toString(a: any) {
|
|
58
|
-
if (typeof a === 'boolean') {
|
|
59
|
-
return String(a)
|
|
60
|
-
}
|
|
61
58
|
if (typeof a === 'number') {
|
|
62
59
|
if (isNaN(a) || a === Infinity || a === -Infinity) {
|
|
63
60
|
return ''
|
|
@@ -74,13 +71,6 @@ function toString(a: any) {
|
|
|
74
71
|
// It handles numbers, mixed alphanumeric combinations, and even
|
|
75
72
|
// null, undefined, and Infinity
|
|
76
73
|
function compareAlphanumeric(aStr: string, bStr: string) {
|
|
77
|
-
// Check if the string contains only a number
|
|
78
|
-
const aFloat = parseFloat(aStr);
|
|
79
|
-
const bFloat = parseFloat(bStr);
|
|
80
|
-
if(!isNaN(aFloat) && !isNaN(bFloat)) {
|
|
81
|
-
return compareBasic(aFloat, bFloat)
|
|
82
|
-
}
|
|
83
|
-
|
|
84
74
|
// Split on number groups, but keep the delimiter
|
|
85
75
|
// Then remove falsey split values
|
|
86
76
|
const a = aStr.split(reSplitAlphaNumeric).filter(Boolean)
|