@tanstack/react-table 8.0.0-alpha.9 → 8.0.0-beta.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/cjs/react-table/src/index.js +139 -0
- package/build/cjs/react-table/src/index.js.map +1 -0
- package/build/cjs/table-core/build/esm/index.js +3867 -0
- package/build/cjs/table-core/build/esm/index.js.map +1 -0
- package/build/esm/index.js +3196 -4117
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +24 -813
- package/build/types/index.d.ts +16 -9
- package/build/umd/index.development.js +3234 -4125
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +11 -1
- package/build/umd/index.production.js.map +1 -1
- package/package.json +10 -6
- package/src/index.tsx +111 -9
- package/build/cjs/_virtual/_rollupPluginBabelHelpers.js +0 -112
- package/build/cjs/_virtual/_rollupPluginBabelHelpers.js.map +0 -1
- package/build/cjs/aggregationTypes.js +0 -130
- package/build/cjs/aggregationTypes.js.map +0 -1
- package/build/cjs/core.js +0 -545
- package/build/cjs/core.js.map +0 -1
- package/build/cjs/createTable.js +0 -122
- package/build/cjs/createTable.js.map +0 -1
- package/build/cjs/features/ColumnSizing.js +0 -318
- package/build/cjs/features/ColumnSizing.js.map +0 -1
- package/build/cjs/features/Expanding.js +0 -239
- package/build/cjs/features/Expanding.js.map +0 -1
- package/build/cjs/features/Filters.js +0 -414
- package/build/cjs/features/Filters.js.map +0 -1
- package/build/cjs/features/Grouping.js +0 -232
- package/build/cjs/features/Grouping.js.map +0 -1
- package/build/cjs/features/Headers.js +0 -629
- package/build/cjs/features/Headers.js.map +0 -1
- package/build/cjs/features/Ordering.js +0 -86
- package/build/cjs/features/Ordering.js.map +0 -1
- package/build/cjs/features/Pagination.js +0 -193
- package/build/cjs/features/Pagination.js.map +0 -1
- package/build/cjs/features/Pinning.js +0 -149
- package/build/cjs/features/Pinning.js.map +0 -1
- package/build/cjs/features/RowSelection.js +0 -526
- package/build/cjs/features/RowSelection.js.map +0 -1
- package/build/cjs/features/Sorting.js +0 -315
- package/build/cjs/features/Sorting.js.map +0 -1
- package/build/cjs/features/Visibility.js +0 -174
- package/build/cjs/features/Visibility.js.map +0 -1
- package/build/cjs/filterTypes.js +0 -172
- package/build/cjs/filterTypes.js.map +0 -1
- package/build/cjs/index.js +0 -44
- package/build/cjs/index.js.map +0 -1
- package/build/cjs/sortTypes.js +0 -122
- package/build/cjs/sortTypes.js.map +0 -1
- package/build/cjs/types.js +0 -22
- package/build/cjs/types.js.map +0 -1
- package/build/cjs/utils/columnFilterRowsFn.js +0 -131
- package/build/cjs/utils/columnFilterRowsFn.js.map +0 -1
- package/build/cjs/utils/expandRowsFn.js +0 -38
- package/build/cjs/utils/expandRowsFn.js.map +0 -1
- package/build/cjs/utils/globalFilterRowsFn.js +0 -101
- package/build/cjs/utils/globalFilterRowsFn.js.map +0 -1
- package/build/cjs/utils/groupRowsFn.js +0 -155
- package/build/cjs/utils/groupRowsFn.js.map +0 -1
- package/build/cjs/utils/paginateRowsFn.js +0 -44
- package/build/cjs/utils/paginateRowsFn.js.map +0 -1
- package/build/cjs/utils/sortRowsFn.js +0 -94
- package/build/cjs/utils/sortRowsFn.js.map +0 -1
- package/build/cjs/utils.js +0 -167
- package/build/cjs/utils.js.map +0 -1
- package/build/types/aggregationTypes.d.ts +0 -22
- package/build/types/core.d.ts +0 -105
- package/build/types/createTable.d.ts +0 -42
- package/build/types/features/ColumnSizing.d.ts +0 -73
- package/build/types/features/Expanding.d.ts +0 -48
- package/build/types/features/Filters.d.ts +0 -90
- package/build/types/features/Grouping.d.ts +0 -83
- package/build/types/features/Headers.d.ts +0 -41
- package/build/types/features/Ordering.d.ts +0 -19
- package/build/types/features/Pagination.d.ts +0 -39
- package/build/types/features/Pinning.d.ts +0 -39
- package/build/types/features/RowSelection.d.ts +0 -58
- package/build/types/features/Sorting.d.ts +0 -79
- package/build/types/features/Visibility.d.ts +0 -47
- package/build/types/filterTypes.d.ts +0 -50
- package/build/types/sortTypes.d.ts +0 -18
- package/build/types/types.d.ts +0 -138
- package/build/types/utils/columnFilterRowsFn.d.ts +0 -2
- package/build/types/utils/expandRowsFn.d.ts +0 -2
- package/build/types/utils/globalFilterRowsFn.d.ts +0 -2
- package/build/types/utils/groupRowsFn.d.ts +0 -2
- package/build/types/utils/paginateRowsFn.d.ts +0 -2
- package/build/types/utils/sortRowsFn.d.ts +0 -2
- package/build/types/utils.d.ts +0 -23
- package/src/aggregationTypes.ts +0 -115
- package/src/core.tsx +0 -763
- package/src/createTable.tsx +0 -186
- package/src/features/ColumnSizing.ts +0 -424
- package/src/features/Expanding.ts +0 -318
- package/src/features/Filters.ts +0 -560
- package/src/features/Grouping.ts +0 -361
- package/src/features/Headers.ts +0 -729
- package/src/features/Ordering.ts +0 -110
- package/src/features/Pagination.ts +0 -250
- package/src/features/Pinning.ts +0 -174
- package/src/features/RowSelection.ts +0 -651
- package/src/features/Sorting.ts +0 -453
- package/src/features/Visibility.ts +0 -238
- package/src/filterTypes.ts +0 -188
- package/src/sortTypes.ts +0 -147
- package/src/types.ts +0 -311
- package/src/utils/columnFilterRowsFn.ts +0 -113
- package/src/utils/expandRowsFn.ts +0 -30
- package/src/utils/globalFilterRowsFn.ts +0 -89
- package/src/utils/groupRowsFn.ts +0 -170
- package/src/utils/paginateRowsFn.ts +0 -28
- package/src/utils/sortRowsFn.ts +0 -95
- package/src/utils.tsx +0 -221
package/src/filterTypes.ts
DELETED
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
import { AccessorFn, PartialGenerics, Row } from './types'
|
|
2
|
-
|
|
3
|
-
export const filterTypes = {
|
|
4
|
-
includesString,
|
|
5
|
-
includesStringSensitive,
|
|
6
|
-
equalsString,
|
|
7
|
-
equalsStringSensitive,
|
|
8
|
-
arrIncludes,
|
|
9
|
-
arrIncludesAll,
|
|
10
|
-
equals,
|
|
11
|
-
weakEquals,
|
|
12
|
-
betweenNumberRange,
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export type BuiltInFilterType = keyof typeof filterTypes
|
|
16
|
-
|
|
17
|
-
function includesString<TGenerics extends PartialGenerics>(
|
|
18
|
-
rows: Row<TGenerics>[],
|
|
19
|
-
columnIds: string[],
|
|
20
|
-
filterValue: unknown
|
|
21
|
-
) {
|
|
22
|
-
const search = String(filterValue).toLowerCase()
|
|
23
|
-
|
|
24
|
-
rows = rows.filter(row => {
|
|
25
|
-
return columnIds.some(id => {
|
|
26
|
-
return String(row.values[id]).toLowerCase().includes(search)
|
|
27
|
-
})
|
|
28
|
-
})
|
|
29
|
-
return rows
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
includesString.autoRemove = (val: any) => testFalsey(val)
|
|
33
|
-
|
|
34
|
-
function includesStringSensitive<TGenerics extends PartialGenerics>(
|
|
35
|
-
rows: Row<TGenerics>[],
|
|
36
|
-
columnIds: string[],
|
|
37
|
-
filterValue: unknown
|
|
38
|
-
) {
|
|
39
|
-
const search = String(filterValue)
|
|
40
|
-
|
|
41
|
-
rows = rows.filter(row => {
|
|
42
|
-
return columnIds.some(id => {
|
|
43
|
-
return String(row.values[id]).includes(search)
|
|
44
|
-
})
|
|
45
|
-
})
|
|
46
|
-
return rows
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
includesStringSensitive.autoRemove = (val: any) => testFalsey(val)
|
|
50
|
-
|
|
51
|
-
function equalsString<TGenerics extends PartialGenerics>(
|
|
52
|
-
rows: Row<TGenerics>[],
|
|
53
|
-
columnIds: string[],
|
|
54
|
-
filterValue: unknown
|
|
55
|
-
) {
|
|
56
|
-
const search = String(filterValue).toLowerCase()
|
|
57
|
-
|
|
58
|
-
return rows.filter(row => {
|
|
59
|
-
return columnIds.some(id => {
|
|
60
|
-
const rowValue = row.values[id]
|
|
61
|
-
return rowValue !== undefined
|
|
62
|
-
? String(rowValue).toLowerCase() === search
|
|
63
|
-
: true
|
|
64
|
-
})
|
|
65
|
-
})
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
equalsString.autoRemove = (val: any) => testFalsey(val)
|
|
69
|
-
|
|
70
|
-
function equalsStringSensitive<TGenerics extends PartialGenerics>(
|
|
71
|
-
rows: Row<TGenerics>[],
|
|
72
|
-
columnIds: string[],
|
|
73
|
-
filterValue: unknown
|
|
74
|
-
) {
|
|
75
|
-
const search = String(filterValue)
|
|
76
|
-
return rows.filter(row => {
|
|
77
|
-
return columnIds.some(id => {
|
|
78
|
-
const rowValue = row.values[id]
|
|
79
|
-
return rowValue !== undefined ? String(rowValue) === search : true
|
|
80
|
-
})
|
|
81
|
-
})
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
equalsStringSensitive.autoRemove = (val: any) => testFalsey(val)
|
|
85
|
-
|
|
86
|
-
function arrIncludes<TGenerics extends PartialGenerics>(
|
|
87
|
-
rows: Row<TGenerics>[],
|
|
88
|
-
columnIds: string[],
|
|
89
|
-
filterValue: unknown
|
|
90
|
-
) {
|
|
91
|
-
return rows.filter(row => {
|
|
92
|
-
return columnIds.some(id => {
|
|
93
|
-
const rowValue = row.values[id]
|
|
94
|
-
return rowValue.includes(filterValue)
|
|
95
|
-
})
|
|
96
|
-
})
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
arrIncludes.autoRemove = (val: any) => testFalsey(val) || !val?.length
|
|
100
|
-
|
|
101
|
-
function arrIncludesAll<TGenerics extends PartialGenerics>(
|
|
102
|
-
rows: Row<TGenerics>[],
|
|
103
|
-
columnIds: string[],
|
|
104
|
-
filterValue: unknown[]
|
|
105
|
-
) {
|
|
106
|
-
return rows.filter(row => {
|
|
107
|
-
return columnIds.some(id => {
|
|
108
|
-
const rowValue = row.values[id]
|
|
109
|
-
return (
|
|
110
|
-
rowValue &&
|
|
111
|
-
rowValue.length &&
|
|
112
|
-
filterValue.every(val => rowValue.includes(val))
|
|
113
|
-
)
|
|
114
|
-
})
|
|
115
|
-
})
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
arrIncludesAll.autoRemove = (val: any) => testFalsey(val) || !val?.length
|
|
119
|
-
|
|
120
|
-
function equals<TGenerics extends PartialGenerics>(
|
|
121
|
-
rows: Row<TGenerics>[],
|
|
122
|
-
columnIds: string[],
|
|
123
|
-
filterValue: unknown
|
|
124
|
-
) {
|
|
125
|
-
return rows.filter(row => {
|
|
126
|
-
return columnIds.some(id => {
|
|
127
|
-
const rowValue = row.values[id]
|
|
128
|
-
return rowValue === filterValue
|
|
129
|
-
})
|
|
130
|
-
})
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
equals.autoRemove = (val: any) => testFalsey(val)
|
|
134
|
-
|
|
135
|
-
function weakEquals<TGenerics extends PartialGenerics>(
|
|
136
|
-
rows: Row<TGenerics>[],
|
|
137
|
-
columnIds: string[],
|
|
138
|
-
filterValue: unknown
|
|
139
|
-
) {
|
|
140
|
-
return rows.filter(row => {
|
|
141
|
-
return columnIds.some(id => {
|
|
142
|
-
const rowValue = row.values[id]
|
|
143
|
-
// eslint-disable-next-line eqeqeq
|
|
144
|
-
return rowValue == filterValue
|
|
145
|
-
})
|
|
146
|
-
})
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
weakEquals.autoRemove = (val: any) => testFalsey(val)
|
|
150
|
-
|
|
151
|
-
function betweenNumberRange<TGenerics extends PartialGenerics>(
|
|
152
|
-
rows: Row<TGenerics>[],
|
|
153
|
-
columnIds: string[],
|
|
154
|
-
filterValue: [unknown, unknown]
|
|
155
|
-
) {
|
|
156
|
-
let [unsafeMin, unsafeMax] = filterValue || []
|
|
157
|
-
|
|
158
|
-
let parsedMin =
|
|
159
|
-
typeof unsafeMin !== 'number' ? parseFloat(unsafeMin as string) : unsafeMin
|
|
160
|
-
let parsedMax =
|
|
161
|
-
typeof unsafeMax !== 'number' ? parseFloat(unsafeMax as string) : unsafeMax
|
|
162
|
-
|
|
163
|
-
let min =
|
|
164
|
-
unsafeMin === null || Number.isNaN(parsedMin) ? -Infinity : parsedMin
|
|
165
|
-
let max = unsafeMax === null || Number.isNaN(parsedMax) ? Infinity : parsedMax
|
|
166
|
-
|
|
167
|
-
if (min > max) {
|
|
168
|
-
const temp = min
|
|
169
|
-
min = max
|
|
170
|
-
max = temp
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
return rows.filter(row => {
|
|
174
|
-
return columnIds.some(id => {
|
|
175
|
-
const rowValue = row.values[id]
|
|
176
|
-
return rowValue >= min && rowValue <= max
|
|
177
|
-
})
|
|
178
|
-
})
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
betweenNumberRange.autoRemove = (val: any) =>
|
|
182
|
-
testFalsey(val) || (testFalsey(val[0]) && testFalsey(val[1]))
|
|
183
|
-
|
|
184
|
-
// Utils
|
|
185
|
-
|
|
186
|
-
function testFalsey(val: any) {
|
|
187
|
-
return val === undefined || val === null || val === ''
|
|
188
|
-
}
|
package/src/sortTypes.ts
DELETED
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
import { PartialGenerics, Row } from './types'
|
|
2
|
-
|
|
3
|
-
export const reSplitAlphaNumeric = /([0-9]+)/gm
|
|
4
|
-
|
|
5
|
-
export const sortTypes = {
|
|
6
|
-
alphanumeric,
|
|
7
|
-
alphanumericCaseSensitive,
|
|
8
|
-
text,
|
|
9
|
-
textCaseSensitive,
|
|
10
|
-
datetime,
|
|
11
|
-
basic,
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export type BuiltInSortType = keyof typeof sortTypes
|
|
15
|
-
|
|
16
|
-
function alphanumeric<TGenerics extends PartialGenerics>(
|
|
17
|
-
rowA: Row<TGenerics>,
|
|
18
|
-
rowB: Row<TGenerics>,
|
|
19
|
-
columnId: string
|
|
20
|
-
) {
|
|
21
|
-
return compareAlphanumeric(
|
|
22
|
-
toString(rowA.values[columnId]).toLowerCase(),
|
|
23
|
-
toString(rowB.values[columnId]).toLowerCase()
|
|
24
|
-
)
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function alphanumericCaseSensitive<TGenerics extends PartialGenerics>(
|
|
28
|
-
rowA: Row<TGenerics>,
|
|
29
|
-
rowB: Row<TGenerics>,
|
|
30
|
-
columnId: string
|
|
31
|
-
) {
|
|
32
|
-
return compareAlphanumeric(
|
|
33
|
-
toString(rowA.values[columnId]),
|
|
34
|
-
toString(rowB.values[columnId])
|
|
35
|
-
)
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// Mixed sorting is slow, but very inclusive of many edge cases.
|
|
39
|
-
// It handles numbers, mixed alphanumeric combinations, and even
|
|
40
|
-
// null, undefined, and Infinity
|
|
41
|
-
function compareAlphanumeric(aStr: string, bStr: string) {
|
|
42
|
-
// Split on number groups, but keep the delimiter
|
|
43
|
-
// Then remove falsey split values
|
|
44
|
-
const a = aStr.split(reSplitAlphaNumeric).filter(Boolean)
|
|
45
|
-
const b = bStr.split(reSplitAlphaNumeric).filter(Boolean)
|
|
46
|
-
|
|
47
|
-
// While
|
|
48
|
-
while (a.length && b.length) {
|
|
49
|
-
const aa = a.shift()!
|
|
50
|
-
const bb = b.shift()!
|
|
51
|
-
|
|
52
|
-
const an = parseInt(aa, 10)
|
|
53
|
-
const bn = parseInt(bb, 10)
|
|
54
|
-
|
|
55
|
-
const combo = [an, bn].sort()
|
|
56
|
-
|
|
57
|
-
// Both are string
|
|
58
|
-
if (isNaN(combo[0]!)) {
|
|
59
|
-
if (aa > bb) {
|
|
60
|
-
return 1
|
|
61
|
-
}
|
|
62
|
-
if (bb > aa) {
|
|
63
|
-
return -1
|
|
64
|
-
}
|
|
65
|
-
continue
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
// One is a string, one is a number
|
|
69
|
-
if (isNaN(combo[1]!)) {
|
|
70
|
-
return isNaN(an) ? -1 : 1
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
// Both are numbers
|
|
74
|
-
if (an > bn) {
|
|
75
|
-
return 1
|
|
76
|
-
}
|
|
77
|
-
if (bn > an) {
|
|
78
|
-
return -1
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
return a.length - b.length
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
// The text filter is more basic (less numeric support)
|
|
86
|
-
// but is much faster
|
|
87
|
-
function text<TGenerics extends PartialGenerics>(
|
|
88
|
-
rowA: Row<TGenerics>,
|
|
89
|
-
rowB: Row<TGenerics>,
|
|
90
|
-
columnId: string
|
|
91
|
-
) {
|
|
92
|
-
return compareBasic(
|
|
93
|
-
toString(rowA.values[columnId]).toLowerCase(),
|
|
94
|
-
toString(rowB.values[columnId]).toLowerCase()
|
|
95
|
-
)
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
// The text filter is more basic (less numeric support)
|
|
99
|
-
// but is much faster
|
|
100
|
-
function textCaseSensitive<TGenerics extends PartialGenerics>(
|
|
101
|
-
rowA: Row<TGenerics>,
|
|
102
|
-
rowB: Row<TGenerics>,
|
|
103
|
-
columnId: string
|
|
104
|
-
) {
|
|
105
|
-
return compareBasic(
|
|
106
|
-
toString(rowA.values[columnId]),
|
|
107
|
-
toString(rowB.values[columnId])
|
|
108
|
-
)
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
function datetime<TGenerics extends PartialGenerics>(
|
|
112
|
-
rowA: Row<TGenerics>,
|
|
113
|
-
rowB: Row<TGenerics>,
|
|
114
|
-
columnId: string
|
|
115
|
-
) {
|
|
116
|
-
return compareBasic(
|
|
117
|
-
(rowA.values[columnId] as Date).getTime(),
|
|
118
|
-
(rowB.values[columnId] as Date).getTime()
|
|
119
|
-
)
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
function basic<TGenerics extends PartialGenerics>(
|
|
123
|
-
rowA: Row<TGenerics>,
|
|
124
|
-
rowB: Row<TGenerics>,
|
|
125
|
-
columnId: string
|
|
126
|
-
) {
|
|
127
|
-
return compareBasic(rowA.values[columnId], rowB.values[columnId])
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
// Utils
|
|
131
|
-
|
|
132
|
-
function compareBasic(a: any, b: any) {
|
|
133
|
-
return a === b ? 0 : a > b ? 1 : -1
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
function toString(a: any) {
|
|
137
|
-
if (typeof a === 'number') {
|
|
138
|
-
if (isNaN(a) || a === Infinity || a === -Infinity) {
|
|
139
|
-
return ''
|
|
140
|
-
}
|
|
141
|
-
return String(a)
|
|
142
|
-
}
|
|
143
|
-
if (typeof a === 'string') {
|
|
144
|
-
return a
|
|
145
|
-
}
|
|
146
|
-
return ''
|
|
147
|
-
}
|
package/src/types.ts
DELETED
|
@@ -1,311 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import {
|
|
3
|
-
CoreColumn,
|
|
4
|
-
CoreColumnDef,
|
|
5
|
-
CoreOptions,
|
|
6
|
-
CoreRow,
|
|
7
|
-
TableCore,
|
|
8
|
-
} from './core'
|
|
9
|
-
import {
|
|
10
|
-
VisibilityInstance,
|
|
11
|
-
VisibilityTableState,
|
|
12
|
-
VisibilityColumn as ColumnVisibilityColumn,
|
|
13
|
-
VisibilityOptions,
|
|
14
|
-
VisibilityColumnDef,
|
|
15
|
-
VisibilityRow,
|
|
16
|
-
} from './features/Visibility'
|
|
17
|
-
import {
|
|
18
|
-
ColumnOrderInstance,
|
|
19
|
-
ColumnOrderOptions,
|
|
20
|
-
ColumnOrderTableState,
|
|
21
|
-
} from './features/Ordering'
|
|
22
|
-
import {
|
|
23
|
-
ColumnPinningColumn,
|
|
24
|
-
ColumnPinningColumnDef,
|
|
25
|
-
ColumnPinningInstance,
|
|
26
|
-
ColumnPinningOptions,
|
|
27
|
-
ColumnPinningTableState,
|
|
28
|
-
} from './features/Pinning'
|
|
29
|
-
import { HeadersInstance, HeadersRow } from './features/Headers'
|
|
30
|
-
import {
|
|
31
|
-
FiltersColumn,
|
|
32
|
-
FiltersColumnDef,
|
|
33
|
-
FiltersInstance,
|
|
34
|
-
FiltersOptions,
|
|
35
|
-
FiltersTableState,
|
|
36
|
-
} from './features/Filters'
|
|
37
|
-
import {
|
|
38
|
-
SortingColumn,
|
|
39
|
-
SortingColumnDef,
|
|
40
|
-
SortingInstance,
|
|
41
|
-
SortingOptions,
|
|
42
|
-
SortingTableState,
|
|
43
|
-
} from './features/Sorting'
|
|
44
|
-
import {
|
|
45
|
-
GroupingColumn,
|
|
46
|
-
GroupingColumnDef,
|
|
47
|
-
GroupingInstance,
|
|
48
|
-
GroupingOptions,
|
|
49
|
-
GroupingRow,
|
|
50
|
-
GroupingTableState,
|
|
51
|
-
} from './features/Grouping'
|
|
52
|
-
import {
|
|
53
|
-
ExpandedInstance,
|
|
54
|
-
ExpandedOptions,
|
|
55
|
-
ExpandedTableState,
|
|
56
|
-
ExpandedRow,
|
|
57
|
-
} from './features/Expanding'
|
|
58
|
-
import { Overwrite } from './utils'
|
|
59
|
-
import {
|
|
60
|
-
ColumnSizingColumn,
|
|
61
|
-
ColumnSizingColumnDef,
|
|
62
|
-
ColumnSizingHeader,
|
|
63
|
-
ColumnSizingInstance,
|
|
64
|
-
ColumnSizingOptions,
|
|
65
|
-
ColumnSizingTableState,
|
|
66
|
-
} from './features/ColumnSizing'
|
|
67
|
-
import {
|
|
68
|
-
PaginationInstance,
|
|
69
|
-
PaginationOptions,
|
|
70
|
-
PaginationTableState,
|
|
71
|
-
} from './features/Pagination'
|
|
72
|
-
import {
|
|
73
|
-
RowSelectionInstance,
|
|
74
|
-
RowSelectionOptions,
|
|
75
|
-
RowSelectionRow,
|
|
76
|
-
RowSelectionTableState,
|
|
77
|
-
} from './features/RowSelection'
|
|
78
|
-
|
|
79
|
-
// declare global {
|
|
80
|
-
// const process.env.NODE_ENV !== 'production': boolean
|
|
81
|
-
// }
|
|
82
|
-
|
|
83
|
-
export type DefaultGenerics = {
|
|
84
|
-
Row: unknown
|
|
85
|
-
Value: unknown
|
|
86
|
-
FilterFns: object
|
|
87
|
-
SortingFns: object
|
|
88
|
-
AggregationFns: object
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
export type PartialGenerics = Partial<DefaultGenerics>
|
|
92
|
-
|
|
93
|
-
export type TableInstance<TGenerics extends PartialGenerics> =
|
|
94
|
-
TableCore<TGenerics> &
|
|
95
|
-
VisibilityInstance<TGenerics> &
|
|
96
|
-
ColumnOrderInstance<TGenerics> &
|
|
97
|
-
ColumnPinningInstance<TGenerics> &
|
|
98
|
-
HeadersInstance<TGenerics> &
|
|
99
|
-
FiltersInstance<TGenerics> &
|
|
100
|
-
SortingInstance<TGenerics> &
|
|
101
|
-
GroupingInstance<TGenerics> &
|
|
102
|
-
ColumnSizingInstance<TGenerics> &
|
|
103
|
-
ExpandedInstance<TGenerics> &
|
|
104
|
-
PaginationInstance<TGenerics> &
|
|
105
|
-
RowSelectionInstance<TGenerics>
|
|
106
|
-
|
|
107
|
-
export type Renderable<TProps> =
|
|
108
|
-
| React.ReactNode
|
|
109
|
-
| React.FunctionComponent<TProps>
|
|
110
|
-
| React.Component<TProps>
|
|
111
|
-
|
|
112
|
-
//
|
|
113
|
-
|
|
114
|
-
export type Options<TGenerics extends PartialGenerics> =
|
|
115
|
-
CoreOptions<TGenerics> &
|
|
116
|
-
VisibilityOptions &
|
|
117
|
-
ColumnOrderOptions &
|
|
118
|
-
ColumnPinningOptions &
|
|
119
|
-
FiltersOptions<TGenerics> &
|
|
120
|
-
SortingOptions<TGenerics> &
|
|
121
|
-
GroupingOptions<TGenerics> &
|
|
122
|
-
ExpandedOptions<TGenerics> &
|
|
123
|
-
ColumnSizingOptions &
|
|
124
|
-
PaginationOptions<TGenerics> &
|
|
125
|
-
RowSelectionOptions<TGenerics>
|
|
126
|
-
|
|
127
|
-
export type Updater<T> = T | ((old: T) => T)
|
|
128
|
-
export type OnChangeFn<T> = (updaterOrValue: Updater<T>, value: T) => void
|
|
129
|
-
|
|
130
|
-
export type TableState = VisibilityTableState &
|
|
131
|
-
ColumnOrderTableState &
|
|
132
|
-
ColumnPinningTableState &
|
|
133
|
-
FiltersTableState &
|
|
134
|
-
SortingTableState &
|
|
135
|
-
ExpandedTableState &
|
|
136
|
-
GroupingTableState &
|
|
137
|
-
ColumnSizingTableState &
|
|
138
|
-
PaginationTableState &
|
|
139
|
-
RowSelectionTableState
|
|
140
|
-
|
|
141
|
-
export type Row<TGenerics extends PartialGenerics> = CoreRow<TGenerics> &
|
|
142
|
-
VisibilityRow<TGenerics> &
|
|
143
|
-
HeadersRow<TGenerics> &
|
|
144
|
-
GroupingRow &
|
|
145
|
-
RowSelectionRow &
|
|
146
|
-
ExpandedRow
|
|
147
|
-
|
|
148
|
-
export type RowValues = {
|
|
149
|
-
[key: string]: any
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
export type RowModel<TGenerics extends PartialGenerics> = {
|
|
153
|
-
rows: Row<TGenerics>[]
|
|
154
|
-
flatRows: Row<TGenerics>[]
|
|
155
|
-
rowsById: Record<string, Row<TGenerics>>
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
export type AccessorFn<TData> = (originalRow: TData, index: number) => any
|
|
159
|
-
|
|
160
|
-
export const Please_use_the_create_table_column_utilities_to_define_columns: unique symbol =
|
|
161
|
-
Symbol()
|
|
162
|
-
|
|
163
|
-
export type _NonGenerated<T> = Overwrite<
|
|
164
|
-
T,
|
|
165
|
-
{
|
|
166
|
-
[Please_use_the_create_table_column_utilities_to_define_columns]?: never
|
|
167
|
-
}
|
|
168
|
-
>
|
|
169
|
-
|
|
170
|
-
export type ColumnDef<TGenerics extends PartialGenerics> =
|
|
171
|
-
CoreColumnDef<TGenerics> &
|
|
172
|
-
VisibilityColumnDef &
|
|
173
|
-
ColumnPinningColumnDef &
|
|
174
|
-
FiltersColumnDef<TGenerics> &
|
|
175
|
-
SortingColumnDef<TGenerics> &
|
|
176
|
-
GroupingColumnDef<TGenerics> &
|
|
177
|
-
ColumnSizingColumnDef
|
|
178
|
-
|
|
179
|
-
export type Column<TGenerics extends PartialGenerics> = ColumnDef<TGenerics> &
|
|
180
|
-
CoreColumn<TGenerics> &
|
|
181
|
-
ColumnVisibilityColumn &
|
|
182
|
-
ColumnPinningColumn &
|
|
183
|
-
FiltersColumn<TGenerics> &
|
|
184
|
-
SortingColumn<TGenerics> &
|
|
185
|
-
GroupingColumn<TGenerics> &
|
|
186
|
-
ColumnSizingColumn<TGenerics>
|
|
187
|
-
|
|
188
|
-
export type Cell<TGenerics extends PartialGenerics> = {
|
|
189
|
-
id: string
|
|
190
|
-
rowId: string
|
|
191
|
-
columnId: string
|
|
192
|
-
value: TGenerics['Value']
|
|
193
|
-
row: Row<TGenerics>
|
|
194
|
-
column: Column<TGenerics>
|
|
195
|
-
getCellProps: PropGetter<CellProps>
|
|
196
|
-
renderCell: () => React.ReactNode
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
export type Header<TGenerics extends PartialGenerics> = CoreHeader<TGenerics> &
|
|
200
|
-
ColumnSizingHeader<TGenerics>
|
|
201
|
-
|
|
202
|
-
export type CoreHeader<TGenerics extends PartialGenerics> = {
|
|
203
|
-
id: string
|
|
204
|
-
depth: number
|
|
205
|
-
column: Column<TGenerics>
|
|
206
|
-
getWidth: () => number
|
|
207
|
-
subHeaders: Header<TGenerics>[]
|
|
208
|
-
colSpan?: number
|
|
209
|
-
rowSpan?: number
|
|
210
|
-
getHeaderProps: PropGetter<HeaderProps>
|
|
211
|
-
getFooterProps: PropGetter<HeaderProps>
|
|
212
|
-
getLeafHeaders: () => Header<TGenerics>[]
|
|
213
|
-
isPlaceholder?: boolean
|
|
214
|
-
placeholderId?: string
|
|
215
|
-
renderHeader: (options?: { renderPlaceholder?: boolean }) => React.ReactNode
|
|
216
|
-
renderFooter: (options?: { renderPlaceholder?: boolean }) => React.ReactNode
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
export type HeaderGroup<TGenerics extends PartialGenerics> = {
|
|
220
|
-
id: string
|
|
221
|
-
depth: number
|
|
222
|
-
headers: Header<TGenerics>[]
|
|
223
|
-
getHeaderGroupProps: PropGetter<HeaderGroupProps>
|
|
224
|
-
getFooterGroupProps: PropGetter<FooterGroupProps>
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
export type HeaderRenderProps<THeader> = {
|
|
228
|
-
header: THeader
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
export type FooterRenderProps<THeader> = {
|
|
232
|
-
header: THeader
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
export type CellRenderProps<TCell, TRow> = {
|
|
236
|
-
cell: TCell
|
|
237
|
-
row: TRow
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
export type TableProps = {
|
|
241
|
-
role: string
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
export type TableBodyProps = {
|
|
245
|
-
role: string
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
export type TableHeadProps = {
|
|
249
|
-
key: string
|
|
250
|
-
role: string
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
export type TableFooterProps = {
|
|
254
|
-
key: string
|
|
255
|
-
role: string
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
export type HeaderGroupProps = {
|
|
259
|
-
key: string
|
|
260
|
-
role: string
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
export type FooterGroupProps = {
|
|
264
|
-
key: string
|
|
265
|
-
role: string
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
export type HeaderProps = {
|
|
269
|
-
key: string
|
|
270
|
-
role: string
|
|
271
|
-
colSpan?: number
|
|
272
|
-
rowSpan?: number
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
export type FooterProps = {
|
|
276
|
-
key: string
|
|
277
|
-
role: string
|
|
278
|
-
colSpan?: number
|
|
279
|
-
rowSpan?: number
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
export type RowProps = {
|
|
283
|
-
key: string
|
|
284
|
-
role: string
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
export type CellProps = {
|
|
288
|
-
key: string
|
|
289
|
-
role: string
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
//
|
|
293
|
-
|
|
294
|
-
export type PropGetter<TBase> = <TGetter extends Getter<TBase>>(
|
|
295
|
-
userProps?: TGetter
|
|
296
|
-
) => PropGetterValue<TBase, TGetter>
|
|
297
|
-
|
|
298
|
-
export type Getter<TInitial> =
|
|
299
|
-
| ((initial: TInitial) => object)
|
|
300
|
-
| object
|
|
301
|
-
| undefined
|
|
302
|
-
|
|
303
|
-
export type PropGetterValue<TBase, TGetter> = TGetter extends undefined
|
|
304
|
-
? TBase
|
|
305
|
-
: TGetter extends (...args: any[]) => infer TReturn
|
|
306
|
-
? Overwrite<TBase, TReturn>
|
|
307
|
-
: TGetter extends object
|
|
308
|
-
? Overwrite<TBase, TGetter>
|
|
309
|
-
: never
|
|
310
|
-
|
|
311
|
-
export type NoInfer<A extends any> = [A][A extends any ? 0 : never]
|