@tanstack/table-core 8.0.0-alpha.37 → 8.0.0-alpha.41

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.0.0-alpha.37",
4
+ "version": "8.0.0-alpha.41",
5
5
  "description": "Hooks for building lightweight, fast and extendable datagrids for React",
6
6
  "license": "MIT",
7
7
  "homepage": "https://github.com/tanstack/react-table#readme",
@@ -34,9 +34,5 @@
34
34
  "files": [
35
35
  "build",
36
36
  "src"
37
- ],
38
- "peerDependencies": {
39
- "react": ">=16",
40
- "react-dom": ">=16"
41
- }
37
+ ]
42
38
  }
@@ -47,7 +47,6 @@ import { Sorting } from './features/Sorting'
47
47
  import { Visibility } from './features/Visibility'
48
48
  import { Headers } from './features/Headers'
49
49
  import { mean } from './aggregationTypes'
50
- import React from 'react'
51
50
 
52
51
  const features: TableFeature[] = [
53
52
  Headers,
File without changes
@@ -381,12 +381,12 @@ export const ColumnSizing = {
381
381
  title: 'Toggle Grouping',
382
382
  draggable: false,
383
383
  role: 'separator',
384
- onMouseDown: (e: MouseEvent & { persist?: () => void }) => {
385
- e.persist?.()
384
+ onMouseDown: (e: MouseEvent) => {
385
+ ;(e as any).persist?.()
386
386
  onResizeStart(e)
387
387
  },
388
- onTouchStart: (e: TouchEvent & { persist?: () => void }) => {
389
- e.persist?.()
388
+ onTouchStart: (e: TouchEvent) => {
389
+ ;(e as any).persist?.()
390
390
  onResizeStart(e)
391
391
  },
392
392
  }
@@ -1,4 +1,3 @@
1
- import { MouseEvent, TouchEvent } from 'react'
2
1
  import { RowModel } from '..'
3
2
  import {
4
3
  Getter,
@@ -53,6 +52,7 @@ export type ExpandedInstance<TGenerics extends AnyGenerics> = {
53
52
  toggleAllRowsExpanded: (expanded?: boolean) => void
54
53
  resetExpanded: () => void
55
54
  getRowCanExpand: (rowId: string) => boolean
55
+ getCanSomeRowsExpand: () => boolean
56
56
  getIsRowExpanded: (rowId: string) => boolean
57
57
  getToggleExpandedProps: <TGetter extends Getter<ToggleExpandedProps>>(
58
58
  rowId: string,
@@ -200,6 +200,11 @@ export const Expanding = {
200
200
  !!row.subRows?.length
201
201
  )
202
202
  },
203
+ getCanSomeRowsExpand: () => {
204
+ return Object.keys(instance.getRowModel().rowsById).some(id =>
205
+ instance.getRowCanExpand(id)
206
+ )
207
+ },
203
208
  getToggleExpandedProps: (rowId, userProps) => {
204
209
  const row = instance.getRow(rowId)
205
210
 
@@ -213,7 +218,7 @@ export const Expanding = {
213
218
  title: canExpand ? 'Toggle Expanded' : undefined,
214
219
  onClick: canExpand
215
220
  ? (e: MouseEvent | TouchEvent) => {
216
- e.persist?.()
221
+ ;(e as any).persist?.()
217
222
  instance.toggleRowExpanded(rowId)
218
223
  }
219
224
  : undefined,
@@ -225,7 +230,7 @@ export const Expanding = {
225
230
  const initialProps: ToggleExpandedProps = {
226
231
  title: 'Toggle All Expanded',
227
232
  onClick: (e: MouseEvent | TouchEvent) => {
228
- e.persist?.()
233
+ ;(e as any).persist?.()
229
234
  instance.toggleAllRowsExpanded()
230
235
  },
231
236
  }
@@ -1,4 +1,3 @@
1
- import { MouseEvent, TouchEvent } from 'react'
2
1
  import { RowModel } from '..'
3
2
  import { BuiltInSortType, reSplitAlphaNumeric, sortTypes } from '../sortTypes'
4
3
 
@@ -430,7 +429,7 @@ export const Sorting = {
430
429
  title: canSort ? 'Toggle Sorting' : undefined,
431
430
  onClick: canSort
432
431
  ? (e: MouseEvent | TouchEvent) => {
433
- e.persist?.()
432
+ ;(e as any).persist?.()
434
433
  column.toggleSorting?.(
435
434
  undefined,
436
435
  column.getCanMultiSort()
File without changes
File without changes