@tanstack/table-core 8.0.0-alpha.13 → 8.0.0-alpha.14
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/core.js +17 -6
- package/build/cjs/core.js.map +1 -1
- package/build/cjs/createTable.js +17 -9
- package/build/cjs/createTable.js.map +1 -1
- package/build/cjs/features/ColumnSizing.js +2 -2
- package/build/cjs/features/ColumnSizing.js.map +1 -1
- package/build/cjs/features/Expanding.js +2 -2
- package/build/cjs/features/Expanding.js.map +1 -1
- package/build/cjs/features/Filters.js +1 -1
- package/build/cjs/features/Filters.js.map +1 -1
- package/build/cjs/features/Grouping.js +13 -2
- package/build/cjs/features/Grouping.js.map +1 -1
- package/build/cjs/features/Headers.js +4 -4
- package/build/cjs/features/Headers.js.map +1 -1
- package/build/cjs/features/RowSelection.js.map +1 -1
- package/build/cjs/features/Visibility.js.map +1 -1
- package/build/cjs/index.js +1 -3
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/types.js +0 -3
- package/build/cjs/types.js.map +1 -1
- package/build/cjs/utils/columnFilterRowsFn.js +1 -1
- package/build/cjs/utils/columnFilterRowsFn.js.map +1 -1
- package/build/cjs/utils/expandRowsFn.js.map +1 -1
- package/build/cjs/utils/globalFilterRowsFn.js.map +1 -1
- package/build/cjs/utils/groupRowsFn.js +1 -1
- package/build/cjs/utils/groupRowsFn.js.map +1 -1
- package/build/cjs/utils/paginateRowsFn.js.map +1 -1
- package/build/cjs/utils/sortRowsFn.js.map +1 -1
- package/build/cjs/utils.js +0 -24
- package/build/cjs/utils.js.map +1 -1
- package/build/esm/index.js +58 -50
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +268 -282
- package/build/types/core.d.ts +11 -9
- package/build/types/createTable.d.ts +24 -14
- package/build/types/features/ColumnSizing.d.ts +2 -3
- package/build/types/features/Grouping.d.ts +11 -5
- package/build/types/features/RowSelection.d.ts +2 -3
- package/build/types/features/Visibility.d.ts +1 -0
- package/build/types/types.d.ts +14 -7
- package/build/types/utils/columnFilterRowsFn.d.ts +2 -2
- package/build/types/utils/expandRowsFn.d.ts +2 -2
- package/build/types/utils/globalFilterRowsFn.d.ts +2 -2
- package/build/types/utils/groupRowsFn.d.ts +2 -2
- package/build/types/utils/paginateRowsFn.d.ts +2 -2
- package/build/types/utils/sortRowsFn.d.ts +2 -2
- package/build/types/utils.d.ts +4 -5
- package/build/umd/index.development.js +62 -58
- 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/core.tsx +63 -35
- package/src/createTable.tsx +49 -31
- package/src/features/ColumnSizing.ts +8 -14
- package/src/features/Expanding.ts +2 -2
- package/src/features/Filters.ts +1 -1
- package/src/features/Grouping.ts +30 -7
- package/src/features/Headers.ts +15 -3
- package/src/features/RowSelection.ts +2 -2
- package/src/features/Visibility.ts +1 -0
- package/src/types.ts +28 -15
- package/src/utils/columnFilterRowsFn.ts +3 -5
- package/src/utils/expandRowsFn.ts +2 -2
- package/src/utils/globalFilterRowsFn.ts +2 -2
- package/src/utils/groupRowsFn.ts +4 -4
- package/src/utils/paginateRowsFn.ts +2 -2
- package/src/utils/sortRowsFn.ts +2 -2
- package/src/utils.tsx +6 -45
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AnyGenerics, TableInstance, Row, RowModel } from '../types'
|
|
2
2
|
|
|
3
|
-
export function columnFilterRowsFn<TGenerics extends
|
|
3
|
+
export function columnFilterRowsFn<TGenerics extends AnyGenerics>(
|
|
4
4
|
instance: TableInstance<TGenerics>,
|
|
5
5
|
rowModel: RowModel<TGenerics>
|
|
6
6
|
): RowModel<TGenerics> {
|
|
@@ -18,9 +18,7 @@ export function columnFilterRowsFn<TGenerics extends PartialGenerics>(
|
|
|
18
18
|
|
|
19
19
|
if (!column) {
|
|
20
20
|
if (process.env.NODE_ENV !== 'production') {
|
|
21
|
-
console.warn(
|
|
22
|
-
`React-Table: Could not find a column with id: ${columnId}`
|
|
23
|
-
)
|
|
21
|
+
console.warn(`Table: Could not find a column with id: ${columnId}`)
|
|
24
22
|
}
|
|
25
23
|
throw new Error()
|
|
26
24
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TableInstance, Row, RowModel, AnyGenerics } from '../types'
|
|
2
2
|
|
|
3
|
-
export function expandRowsFn<TGenerics extends
|
|
3
|
+
export function expandRowsFn<TGenerics extends AnyGenerics>(
|
|
4
4
|
instance: TableInstance<TGenerics>,
|
|
5
5
|
sortedRowModel: RowModel<TGenerics>
|
|
6
6
|
): RowModel<TGenerics> {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TableInstance, Row, RowModel, AnyGenerics } from '../types'
|
|
2
2
|
|
|
3
|
-
export function globalFilterRowsFn<TGenerics extends
|
|
3
|
+
export function globalFilterRowsFn<TGenerics extends AnyGenerics>(
|
|
4
4
|
instance: TableInstance<TGenerics>,
|
|
5
5
|
rowModel: RowModel<TGenerics>
|
|
6
6
|
): RowModel<TGenerics> {
|
package/src/utils/groupRowsFn.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TableInstance, Row, RowModel, AnyGenerics } from '../types'
|
|
2
2
|
import { flattenBy } from '../utils'
|
|
3
3
|
|
|
4
|
-
export function groupRowsFn<TGenerics extends
|
|
4
|
+
export function groupRowsFn<TGenerics extends AnyGenerics>(
|
|
5
5
|
instance: TableInstance<TGenerics>,
|
|
6
6
|
sortedRowModel: RowModel<TGenerics>
|
|
7
7
|
): RowModel<TGenerics> {
|
|
@@ -52,7 +52,7 @@ export function groupRowsFn<TGenerics extends PartialGenerics>(
|
|
|
52
52
|
console.info({ column })
|
|
53
53
|
throw new Error(
|
|
54
54
|
process.env.NODE_ENV !== 'production'
|
|
55
|
-
? `
|
|
55
|
+
? `Table: Invalid column.aggregateType option for column listed above`
|
|
56
56
|
: ''
|
|
57
57
|
)
|
|
58
58
|
} else {
|
|
@@ -151,7 +151,7 @@ export function groupRowsFn<TGenerics extends PartialGenerics>(
|
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
153
|
|
|
154
|
-
function groupBy<TGenerics extends
|
|
154
|
+
function groupBy<TGenerics extends AnyGenerics>(
|
|
155
155
|
rows: Row<TGenerics>[],
|
|
156
156
|
columnId: string
|
|
157
157
|
) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TableInstance, RowModel, AnyGenerics } from '../types'
|
|
2
2
|
import { expandRowsFn } from './expandRowsFn'
|
|
3
3
|
|
|
4
|
-
export function paginateRowsFn<TGenerics extends
|
|
4
|
+
export function paginateRowsFn<TGenerics extends AnyGenerics>(
|
|
5
5
|
instance: TableInstance<TGenerics>,
|
|
6
6
|
rowModel: RowModel<TGenerics>
|
|
7
7
|
): RowModel<TGenerics> {
|
package/src/utils/sortRowsFn.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TableInstance, Row, RowModel, AnyGenerics } from '../types'
|
|
2
2
|
import { SortingFn } from '../features/Sorting'
|
|
3
3
|
|
|
4
|
-
export function sortRowsFn<TGenerics extends
|
|
4
|
+
export function sortRowsFn<TGenerics extends AnyGenerics>(
|
|
5
5
|
instance: TableInstance<TGenerics>,
|
|
6
6
|
rowModel: RowModel<TGenerics>
|
|
7
7
|
): RowModel<TGenerics> {
|
package/src/utils.tsx
CHANGED
|
@@ -1,18 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
Getter,
|
|
4
|
-
NoInfer,
|
|
5
|
-
PropGetterValue,
|
|
6
|
-
Renderable,
|
|
7
|
-
TableState,
|
|
8
|
-
Updater,
|
|
9
|
-
} from './types'
|
|
1
|
+
import { Getter, NoInfer, PropGetterValue, TableState, Updater } from './types'
|
|
10
2
|
|
|
11
3
|
export type IsAny<T> = 0 extends 1 & T ? true : false
|
|
12
4
|
export type PartialKeys<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>
|
|
13
5
|
export type RequiredKeys<T, K extends keyof T> = Omit<T, K> &
|
|
14
6
|
Required<Pick<T, K>>
|
|
15
|
-
export type Overwrite<T, U
|
|
7
|
+
export type Overwrite<T, U extends { [TKey in keyof T]?: any }> = Omit<
|
|
8
|
+
T,
|
|
9
|
+
keyof U
|
|
10
|
+
> &
|
|
11
|
+
U
|
|
16
12
|
|
|
17
13
|
export type DataUpdateFunction<T> = (input: T) => T
|
|
18
14
|
|
|
@@ -168,41 +164,6 @@ export function memo<TDeps extends readonly any[], TResult>(
|
|
|
168
164
|
}
|
|
169
165
|
}
|
|
170
166
|
|
|
171
|
-
export type Render = typeof flexRender
|
|
172
|
-
|
|
173
|
-
export function flexRender<TProps extends {}>(
|
|
174
|
-
Comp: Renderable<TProps>,
|
|
175
|
-
props: TProps
|
|
176
|
-
): React.ReactNode {
|
|
177
|
-
return !Comp ? null : isReactComponent(Comp) ? <Comp {...props} /> : Comp
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
function isReactComponent(component: unknown): component is React.FC {
|
|
181
|
-
return (
|
|
182
|
-
isClassComponent(component) ||
|
|
183
|
-
typeof component === 'function' ||
|
|
184
|
-
isExoticComponent(component)
|
|
185
|
-
)
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
function isClassComponent(component: any) {
|
|
189
|
-
return (
|
|
190
|
-
typeof component === 'function' &&
|
|
191
|
-
(() => {
|
|
192
|
-
const proto = Object.getPrototypeOf(component)
|
|
193
|
-
return proto.prototype && proto.prototype.isReactComponent
|
|
194
|
-
})()
|
|
195
|
-
)
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
function isExoticComponent(component: any) {
|
|
199
|
-
return (
|
|
200
|
-
typeof component === 'object' &&
|
|
201
|
-
typeof component.$$typeof === 'symbol' &&
|
|
202
|
-
['react.memo', 'react.forward_ref'].includes(component.$$typeof.description)
|
|
203
|
-
)
|
|
204
|
-
}
|
|
205
|
-
|
|
206
167
|
// export function hashString(str: string, seed = 0): string {
|
|
207
168
|
// let h1 = 0xdeadbeef ^ seed,
|
|
208
169
|
// h2 = 0x41c6ce57 ^ seed
|