@tanstack/table-core 8.0.0-alpha.45 → 8.0.0-alpha.46
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/cjs/features/ColumnSizing.js.map +1 -1
- package/build/cjs/features/Expanding.js.map +1 -1
- package/build/cjs/features/Grouping.js.map +1 -1
- package/build/cjs/features/RowSelection.js +2 -2
- package/build/cjs/features/RowSelection.js.map +1 -1
- package/build/cjs/features/Sorting.js.map +1 -1
- package/build/cjs/features/Visibility.js.map +1 -1
- package/build/esm/index.js +2 -2
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +291 -291
- package/build/types/features/Expanding.d.ts +1 -1
- package/build/types/features/Grouping.d.ts +1 -1
- package/build/types/features/RowSelection.d.ts +1 -1
- package/build/types/features/Sorting.d.ts +2 -2
- package/build/umd/index.development.js +2 -2
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js.map +1 -1
- package/package.json +1 -1
- package/src/features/ColumnSizing.ts +4 -4
- package/src/features/Expanding.ts +3 -3
- package/src/features/Grouping.ts +2 -2
- package/src/features/RowSelection.ts +13 -11
- package/src/features/Sorting.ts +5 -5
- package/src/features/Visibility.ts +4 -2
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.
|
|
4
|
+
"version": "8.0.0-alpha.46",
|
|
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",
|
|
@@ -228,7 +228,7 @@ export const ColumnSizing = {
|
|
|
228
228
|
|
|
229
229
|
const canResize = column.getCanResize()
|
|
230
230
|
|
|
231
|
-
const onResizeStart = (e:
|
|
231
|
+
const onResizeStart = (e: unknown) => {
|
|
232
232
|
if (isTouchStartEvent(e)) {
|
|
233
233
|
// lets not respond to multiple touches (e.g. 2 or 3 fingers)
|
|
234
234
|
if (e.touches && e.touches.length > 1) {
|
|
@@ -246,7 +246,7 @@ export const ColumnSizing = {
|
|
|
246
246
|
|
|
247
247
|
const clientX = isTouchStartEvent(e)
|
|
248
248
|
? Math.round(e.touches[0].clientX)
|
|
249
|
-
: e.clientX
|
|
249
|
+
: (e as MouseEvent).clientX
|
|
250
250
|
|
|
251
251
|
const updateOffset = (
|
|
252
252
|
eventType: 'move' | 'end',
|
|
@@ -446,6 +446,6 @@ export function passiveEventSupported() {
|
|
|
446
446
|
return passiveSupported
|
|
447
447
|
}
|
|
448
448
|
|
|
449
|
-
function isTouchStartEvent(e:
|
|
450
|
-
return e.type === 'touchstart'
|
|
449
|
+
function isTouchStartEvent(e: unknown): e is TouchEvent {
|
|
450
|
+
return (e as TouchEvent).type === 'touchstart'
|
|
451
451
|
}
|
|
@@ -42,7 +42,7 @@ export type ExpandedOptions<TGenerics extends AnyGenerics> = {
|
|
|
42
42
|
|
|
43
43
|
export type ToggleExpandedProps = {
|
|
44
44
|
title?: string
|
|
45
|
-
onClick?: (event:
|
|
45
|
+
onClick?: (event: unknown) => void
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
export type ExpandedInstance<TGenerics extends AnyGenerics> = {
|
|
@@ -217,7 +217,7 @@ export const Expanding = {
|
|
|
217
217
|
const initialProps: ToggleExpandedProps = {
|
|
218
218
|
title: canExpand ? 'Toggle Expanded' : undefined,
|
|
219
219
|
onClick: canExpand
|
|
220
|
-
? (e:
|
|
220
|
+
? (e: unknown) => {
|
|
221
221
|
;(e as any).persist?.()
|
|
222
222
|
instance.toggleRowExpanded(rowId)
|
|
223
223
|
}
|
|
@@ -229,7 +229,7 @@ export const Expanding = {
|
|
|
229
229
|
getToggleAllRowsExpandedProps: userProps => {
|
|
230
230
|
const initialProps: ToggleExpandedProps = {
|
|
231
231
|
title: 'Toggle All Expanded',
|
|
232
|
-
onClick: (e:
|
|
232
|
+
onClick: (e: unknown) => {
|
|
233
233
|
;(e as any).persist?.()
|
|
234
234
|
instance.toggleAllRowsExpanded()
|
|
235
235
|
},
|
package/src/features/Grouping.ts
CHANGED
|
@@ -110,7 +110,7 @@ export type GroupingColumnMode = false | 'reorder' | 'remove'
|
|
|
110
110
|
|
|
111
111
|
export type ToggleGroupingProps = {
|
|
112
112
|
title?: string
|
|
113
|
-
onClick?: (event:
|
|
113
|
+
onClick?: (event: unknown) => void
|
|
114
114
|
}
|
|
115
115
|
|
|
116
116
|
export type GroupingInstance<TGenerics extends AnyGenerics> = {
|
|
@@ -290,7 +290,7 @@ export const Grouping = {
|
|
|
290
290
|
const initialProps: ToggleGroupingProps = {
|
|
291
291
|
title: canGroup ? 'Toggle Grouping' : undefined,
|
|
292
292
|
onClick: canGroup
|
|
293
|
-
? (e:
|
|
293
|
+
? (e: unknown) => {
|
|
294
294
|
column.toggleGrouping?.()
|
|
295
295
|
}
|
|
296
296
|
: undefined,
|
|
@@ -28,8 +28,8 @@ export type RowSelectionOptions<TGenerics extends AnyGenerics> = {
|
|
|
28
28
|
// | ((
|
|
29
29
|
// row: Row<TGenerics>
|
|
30
30
|
// ) => boolean)
|
|
31
|
-
// isAdditiveSelectEvent?: (e:
|
|
32
|
-
// isInclusiveSelectEvent?: (e:
|
|
31
|
+
// isAdditiveSelectEvent?: (e: unknown) => boolean
|
|
32
|
+
// isInclusiveSelectEvent?: (e: unknown) => boolean
|
|
33
33
|
// selectRowsFn?: (
|
|
34
34
|
// instance: TableInstance<
|
|
35
35
|
// TData,
|
|
@@ -43,7 +43,7 @@ export type RowSelectionOptions<TGenerics extends AnyGenerics> = {
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
type ToggleRowSelectedProps = {
|
|
46
|
-
onChange?: (e:
|
|
46
|
+
onChange?: (e: unknown) => void
|
|
47
47
|
checked?: boolean
|
|
48
48
|
title?: string
|
|
49
49
|
indeterminate?: boolean
|
|
@@ -116,8 +116,8 @@ export const RowSelection = {
|
|
|
116
116
|
enableMultiRowSelection: true,
|
|
117
117
|
enableSubRowSelection: true,
|
|
118
118
|
// enableGroupingRowSelection: false,
|
|
119
|
-
// isAdditiveSelectEvent: (e:
|
|
120
|
-
// isInclusiveSelectEvent: (e:
|
|
119
|
+
// isAdditiveSelectEvent: (e: unknown) => !!e.metaKey,
|
|
120
|
+
// isInclusiveSelectEvent: (e: unknown) => !!e.shiftKey,
|
|
121
121
|
}
|
|
122
122
|
},
|
|
123
123
|
|
|
@@ -473,8 +473,10 @@ export const RowSelection = {
|
|
|
473
473
|
|
|
474
474
|
const initialProps: ToggleRowSelectedProps = {
|
|
475
475
|
onChange: canSelect
|
|
476
|
-
? (e:
|
|
477
|
-
row.toggleSelected(
|
|
476
|
+
? (e: unknown) => {
|
|
477
|
+
row.toggleSelected(
|
|
478
|
+
((e as MouseEvent).target as HTMLInputElement).checked
|
|
479
|
+
)
|
|
478
480
|
}
|
|
479
481
|
: undefined,
|
|
480
482
|
checked: isSelected,
|
|
@@ -504,9 +506,9 @@ export const RowSelection = {
|
|
|
504
506
|
const isAllRowsSelected = instance.getIsAllRowsSelected()
|
|
505
507
|
|
|
506
508
|
const initialProps: ToggleRowSelectedProps = {
|
|
507
|
-
onChange: (e:
|
|
509
|
+
onChange: (e: unknown) => {
|
|
508
510
|
instance.toggleAllRowsSelected(
|
|
509
|
-
(e.target as HTMLInputElement).checked
|
|
511
|
+
((e as MouseEvent).target as HTMLInputElement).checked
|
|
510
512
|
)
|
|
511
513
|
},
|
|
512
514
|
checked: isAllRowsSelected,
|
|
@@ -522,9 +524,9 @@ export const RowSelection = {
|
|
|
522
524
|
const isAllPageRowsSelected = instance.getIsAllPageRowsSelected()
|
|
523
525
|
|
|
524
526
|
const initialProps: ToggleRowSelectedProps = {
|
|
525
|
-
onChange: (e:
|
|
527
|
+
onChange: (e: unknown) => {
|
|
526
528
|
instance.toggleAllPageRowsSelected(
|
|
527
|
-
(e.target as HTMLInputElement).checked
|
|
529
|
+
((e as MouseEvent).target as HTMLInputElement).checked
|
|
528
530
|
)
|
|
529
531
|
},
|
|
530
532
|
checked: isAllPageRowsSelected,
|
package/src/features/Sorting.ts
CHANGED
|
@@ -87,12 +87,12 @@ export type SortingOptions<TGenerics extends AnyGenerics> = {
|
|
|
87
87
|
instance: TableInstance<TGenerics>
|
|
88
88
|
) => () => RowModel<TGenerics>
|
|
89
89
|
maxMultiSortColCount?: number
|
|
90
|
-
isMultiSortEvent?: (e:
|
|
90
|
+
isMultiSortEvent?: (e: unknown) => boolean
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
export type ToggleSortingProps = {
|
|
94
94
|
title?: string
|
|
95
|
-
onClick?: (event:
|
|
95
|
+
onClick?: (event: unknown) => void
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
export type SortingInstance<TGenerics extends AnyGenerics> = {
|
|
@@ -145,8 +145,8 @@ export const Sorting = {
|
|
|
145
145
|
return {
|
|
146
146
|
onSortingChange: makeStateUpdater('sorting', instance),
|
|
147
147
|
autoResetSorting: true,
|
|
148
|
-
isMultiSortEvent: (e:
|
|
149
|
-
return e.shiftKey
|
|
148
|
+
isMultiSortEvent: (e: unknown) => {
|
|
149
|
+
return (e as MouseEvent).shiftKey
|
|
150
150
|
},
|
|
151
151
|
}
|
|
152
152
|
},
|
|
@@ -428,7 +428,7 @@ export const Sorting = {
|
|
|
428
428
|
const initialProps: ToggleSortingProps = {
|
|
429
429
|
title: canSort ? 'Toggle Sorting' : undefined,
|
|
430
430
|
onClick: canSort
|
|
431
|
-
? (e:
|
|
431
|
+
? (e: unknown) => {
|
|
432
432
|
;(e as any).persist?.()
|
|
433
433
|
column.toggleSorting?.(
|
|
434
434
|
undefined,
|
|
@@ -102,8 +102,10 @@ export const Visibility = {
|
|
|
102
102
|
type: 'checkbox',
|
|
103
103
|
checked: column.getIsVisible?.(),
|
|
104
104
|
title: 'Toggle Column Visibility',
|
|
105
|
-
onChange: (e:
|
|
106
|
-
column.toggleVisibility?.(
|
|
105
|
+
onChange: (e: unknown) => {
|
|
106
|
+
column.toggleVisibility?.(
|
|
107
|
+
((e as MouseEvent).target as HTMLInputElement).checked
|
|
108
|
+
)
|
|
107
109
|
},
|
|
108
110
|
}
|
|
109
111
|
|