@tanstack/table-core 8.10.7 → 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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tanstack/table-core",
3
3
  "author": "Tanner Linsley",
4
- "version": "8.10.7",
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 deltaOffset = clientXPos - (old?.startOffset ?? 0)
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 all rows on the current page are selected.
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 all rows in the table are selected.
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
  */