@tanstack/react-table 0.0.1-alpha.9 → 8.0.0-alpha.3
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/_virtual/_rollupPluginBabelHelpers.js +112 -0
- package/build/cjs/_virtual/_rollupPluginBabelHelpers.js.map +1 -0
- package/build/cjs/aggregationTypes.js +130 -0
- package/build/cjs/aggregationTypes.js.map +1 -0
- package/build/cjs/core.js +552 -0
- package/build/cjs/core.js.map +1 -0
- package/build/cjs/createTable.js +108 -0
- package/build/cjs/createTable.js.map +1 -0
- package/build/cjs/features/ColumnSizing.js +317 -0
- package/build/cjs/features/ColumnSizing.js.map +1 -0
- package/build/cjs/features/Expanding.js +255 -0
- package/build/cjs/features/Expanding.js.map +1 -0
- package/build/cjs/features/Filters.js +445 -0
- package/build/cjs/features/Filters.js.map +1 -0
- package/build/cjs/features/Grouping.js +249 -0
- package/build/cjs/features/Grouping.js.map +1 -0
- package/build/cjs/features/Headers.js +549 -0
- package/build/cjs/features/Headers.js.map +1 -0
- package/build/cjs/features/Ordering.js +86 -0
- package/build/cjs/features/Ordering.js.map +1 -0
- package/build/cjs/features/Pagination.js +194 -0
- package/build/cjs/features/Pagination.js.map +1 -0
- package/build/cjs/features/Pinning.js +149 -0
- package/build/cjs/features/Pinning.js.map +1 -0
- package/build/cjs/features/RowSelection.js +541 -0
- package/build/cjs/features/RowSelection.js.map +1 -0
- package/build/cjs/features/Sorting.js +327 -0
- package/build/cjs/features/Sorting.js.map +1 -0
- package/build/cjs/features/Visibility.js +166 -0
- package/build/cjs/features/Visibility.js.map +1 -0
- package/build/cjs/filterTypes.js +172 -0
- package/build/cjs/filterTypes.js.map +1 -0
- package/build/cjs/index.js +30 -0
- package/build/cjs/index.js.map +1 -0
- package/build/cjs/sortTypes.js +122 -0
- package/build/cjs/sortTypes.js.map +1 -0
- package/build/cjs/utils/columnFilterRowsFn.js +131 -0
- package/build/cjs/utils/columnFilterRowsFn.js.map +1 -0
- package/build/cjs/utils/expandRowsFn.js +38 -0
- package/build/cjs/utils/expandRowsFn.js.map +1 -0
- package/build/cjs/utils/globalFilterRowsFn.js +101 -0
- package/build/cjs/utils/globalFilterRowsFn.js.map +1 -0
- package/build/cjs/utils/groupRowsFn.js +155 -0
- package/build/cjs/utils/groupRowsFn.js.map +1 -0
- package/build/cjs/utils/sortRowsFn.js +94 -0
- package/build/cjs/utils/sortRowsFn.js.map +1 -0
- package/build/cjs/utils.js +146 -0
- package/build/cjs/utils.js.map +1 -0
- package/build/esm/index.js +4747 -0
- package/build/esm/index.js.map +1 -0
- package/build/stats-html.html +2689 -0
- package/build/stats-react.json +817 -0
- package/build/types/aggregationTypes.d.ts +22 -0
- package/build/types/core.d.ts +111 -0
- package/build/types/createTable.d.ts +53 -0
- package/build/types/features/ColumnSizing.d.ts +67 -0
- package/build/types/features/Expanding.d.ts +53 -0
- package/build/types/features/Filters.d.ts +98 -0
- package/build/types/features/Grouping.d.ts +82 -0
- package/build/types/features/Headers.d.ts +41 -0
- package/build/types/features/Ordering.d.ts +19 -0
- package/build/types/features/Pagination.d.ts +43 -0
- package/build/types/features/Pinning.d.ts +39 -0
- package/build/types/features/RowSelection.d.ts +66 -0
- package/build/types/features/Sorting.d.ts +78 -0
- package/build/types/features/Visibility.d.ts +47 -0
- package/build/types/filterTypes.d.ts +50 -0
- package/build/types/index.d.ts +7 -0
- package/build/types/sortTypes.d.ts +18 -0
- package/build/types/types.d.ts +127 -0
- package/build/types/utils/columnFilterRowsFn.d.ts +2 -0
- package/build/types/utils/expandRowsFn.d.ts +2 -0
- package/build/types/utils/globalFilterRowsFn.d.ts +2 -0
- package/build/types/utils/groupRowsFn.d.ts +2 -0
- package/build/types/utils/paginateRowsFn.d.ts +2 -0
- package/build/types/utils/sortRowsFn.d.ts +2 -0
- package/build/types/utils.d.ts +28 -0
- package/{dist/react-table.development.js → build/umd/index.development.js} +1617 -249
- package/build/umd/index.development.js.map +1 -0
- package/build/umd/index.production.js +12 -0
- package/build/umd/index.production.js.map +1 -0
- package/package.json +9 -94
- package/src/core.tsx +252 -264
- package/src/createTable.tsx +69 -9
- package/src/features/ColumnSizing.ts +453 -0
- package/src/features/Expanding.ts +27 -11
- package/src/features/Filters.ts +75 -20
- package/src/features/Grouping.ts +27 -12
- package/src/features/Headers.ts +55 -50
- package/src/features/Ordering.ts +2 -3
- package/src/features/Pagination.ts +314 -0
- package/src/features/Pinning.ts +3 -16
- package/src/features/RowSelection.ts +831 -0
- package/src/features/Sorting.ts +82 -22
- package/src/features/Visibility.ts +2 -4
- package/src/sortTypes.ts +1 -1
- package/src/types.ts +55 -9
- package/src/utils/columnFilterRowsFn.ts +5 -12
- package/src/utils/expandRowsFn.ts +2 -5
- package/src/utils/globalFilterRowsFn.ts +3 -10
- package/src/utils/groupRowsFn.ts +3 -5
- package/src/utils/paginateRowsFn.ts +34 -0
- package/src/utils/sortRowsFn.ts +5 -5
- package/src/utils.tsx +20 -6
- package/dist/react-table.development.js.map +0 -1
- package/dist/react-table.production.min.js +0 -2
- package/dist/react-table.production.min.js.map +0 -1
- package/lib/index.js +0 -65
- package/src/features/notest/useAbsoluteLayout.test.js +0 -152
- package/src/features/notest/useBlockLayout.test.js +0 -158
- package/src/features/notest/useColumnOrder.test.js +0 -186
- package/src/features/notest/useExpanded.test.js +0 -125
- package/src/features/notest/useFilters.test.js +0 -393
- package/src/features/notest/useFiltersAndRowSelect.test.js +0 -256
- package/src/features/notest/useFlexLayout.test.js +0 -152
- package/src/features/notest/useGroupBy.test.js +0 -259
- package/src/features/notest/usePagination.test.js +0 -231
- package/src/features/notest/useResizeColumns.test.js +0 -229
- package/src/features/notest/useRowSelect.test.js +0 -250
- package/src/features/notest/useRowState.test.js +0 -178
- package/src/features/tests/Visibility.test.tsx +0 -225
- package/src/features/tests/__snapshots__/Visibility.test.tsx.snap +0 -390
- package/src/features/tests/withSorting.notest.tsx +0 -341
- package/src/features/withColumnResizing.ts +0 -281
- package/src/features/withPagination.ts +0 -208
- package/src/features/withRowSelection.ts +0 -467
- package/src/test-utils/makeTestData.ts +0 -41
- package/src/tests/__snapshots__/core.test.tsx.snap +0 -148
- package/src/tests/core.test.tsx +0 -241
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Column,
|
|
3
|
+
OnChangeFn,
|
|
4
|
+
ReactTable,
|
|
5
|
+
Row,
|
|
6
|
+
RowModel,
|
|
7
|
+
TableState,
|
|
8
|
+
Updater,
|
|
9
|
+
} from '../types'
|
|
10
|
+
import { functionalUpdate, makeStateUpdater, memo } from '../utils'
|
|
11
|
+
|
|
12
|
+
export type PaginationState = {
|
|
13
|
+
pageIndex: number
|
|
14
|
+
pageSize: number
|
|
15
|
+
pageCount: number
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export type PaginationTableState = {
|
|
19
|
+
pagination: PaginationState
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export type PaginationOptions<
|
|
23
|
+
TData,
|
|
24
|
+
TValue,
|
|
25
|
+
TFilterFns,
|
|
26
|
+
TSortingFns,
|
|
27
|
+
TAggregationFns
|
|
28
|
+
> = {
|
|
29
|
+
onPaginationChange?: OnChangeFn<PaginationState>
|
|
30
|
+
autoResetPageIndex?: boolean
|
|
31
|
+
paginateRowsFn?: (
|
|
32
|
+
instance: ReactTable<
|
|
33
|
+
TData,
|
|
34
|
+
TValue,
|
|
35
|
+
TFilterFns,
|
|
36
|
+
TSortingFns,
|
|
37
|
+
TAggregationFns
|
|
38
|
+
>,
|
|
39
|
+
rowModel: RowModel<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>
|
|
40
|
+
) => RowModel<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export type PaginationDefaultOptions = {
|
|
44
|
+
onPaginationChange: OnChangeFn<PaginationState>
|
|
45
|
+
autoResetPageIndex: boolean
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export type PaginationInstance<
|
|
49
|
+
TData,
|
|
50
|
+
TValue,
|
|
51
|
+
TFilterFns,
|
|
52
|
+
TSortingFns,
|
|
53
|
+
TAggregationFns
|
|
54
|
+
> = {
|
|
55
|
+
_notifyPageIndexReset: () => void
|
|
56
|
+
setPagination: (updater: Updater<PaginationState>) => void
|
|
57
|
+
resetPagination: () => void
|
|
58
|
+
setPageIndex: (updater: Updater<number>) => void
|
|
59
|
+
resetPageIndex: () => void
|
|
60
|
+
setPageSize: (updater: Updater<number>) => void
|
|
61
|
+
resetPageSize: () => void
|
|
62
|
+
setPageCount: (updater: Updater<number>) => void
|
|
63
|
+
getPageOptions: () => number[]
|
|
64
|
+
getCanPreviousPage: () => boolean
|
|
65
|
+
getCanNextPage: () => boolean
|
|
66
|
+
gotoPreviousPage: () => void
|
|
67
|
+
gotoNextPage: () => void
|
|
68
|
+
getPaginationRowModel: () => RowModel<
|
|
69
|
+
TData,
|
|
70
|
+
TValue,
|
|
71
|
+
TFilterFns,
|
|
72
|
+
TSortingFns,
|
|
73
|
+
TAggregationFns
|
|
74
|
+
>
|
|
75
|
+
getPrePaginationRows: () => Row<
|
|
76
|
+
TData,
|
|
77
|
+
TValue,
|
|
78
|
+
TFilterFns,
|
|
79
|
+
TSortingFns,
|
|
80
|
+
TAggregationFns
|
|
81
|
+
>[]
|
|
82
|
+
getPrePaginationFlatRows: () => Row<
|
|
83
|
+
TData,
|
|
84
|
+
TValue,
|
|
85
|
+
TFilterFns,
|
|
86
|
+
TSortingFns,
|
|
87
|
+
TAggregationFns
|
|
88
|
+
>[]
|
|
89
|
+
getPrePaginationRowsById: () => Record<
|
|
90
|
+
string,
|
|
91
|
+
Row<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>
|
|
92
|
+
>
|
|
93
|
+
getPaginationRows: () => Row<
|
|
94
|
+
TData,
|
|
95
|
+
TValue,
|
|
96
|
+
TFilterFns,
|
|
97
|
+
TSortingFns,
|
|
98
|
+
TAggregationFns
|
|
99
|
+
>[]
|
|
100
|
+
getPaginationFlatRows: () => Row<
|
|
101
|
+
TData,
|
|
102
|
+
TValue,
|
|
103
|
+
TFilterFns,
|
|
104
|
+
TSortingFns,
|
|
105
|
+
TAggregationFns
|
|
106
|
+
>[]
|
|
107
|
+
getPaginationRowsById: () => Record<
|
|
108
|
+
string,
|
|
109
|
+
Row<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>
|
|
110
|
+
>
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
//
|
|
114
|
+
|
|
115
|
+
export function getInitialState(): PaginationTableState {
|
|
116
|
+
return {
|
|
117
|
+
pagination: {
|
|
118
|
+
pageIndex: 0,
|
|
119
|
+
pageSize: 10,
|
|
120
|
+
pageCount: -1,
|
|
121
|
+
},
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export function getDefaultOptions<
|
|
126
|
+
TData,
|
|
127
|
+
TValue,
|
|
128
|
+
TFilterFns,
|
|
129
|
+
TSortingFns,
|
|
130
|
+
TAggregationFns
|
|
131
|
+
>(
|
|
132
|
+
instance: ReactTable<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>
|
|
133
|
+
): PaginationDefaultOptions {
|
|
134
|
+
return {
|
|
135
|
+
onPaginationChange: makeStateUpdater('pagination', instance),
|
|
136
|
+
autoResetPageIndex: true,
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export function getInstance<
|
|
141
|
+
TData,
|
|
142
|
+
TValue,
|
|
143
|
+
TFilterFns,
|
|
144
|
+
TSortingFns,
|
|
145
|
+
TAggregationFns
|
|
146
|
+
>(
|
|
147
|
+
instance: ReactTable<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>
|
|
148
|
+
): PaginationInstance<TData, TValue, TFilterFns, TSortingFns, TAggregationFns> {
|
|
149
|
+
let registered = false
|
|
150
|
+
return {
|
|
151
|
+
_notifyPageIndexReset: () => {
|
|
152
|
+
if (!registered) {
|
|
153
|
+
registered = true
|
|
154
|
+
return
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
if (instance.options.autoResetAll === false) {
|
|
158
|
+
return
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
if (
|
|
162
|
+
instance.options.autoResetAll === true ||
|
|
163
|
+
instance.options.autoResetPageIndex
|
|
164
|
+
) {
|
|
165
|
+
instance.resetPageSize()
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
setPagination: updater => {
|
|
169
|
+
const safeUpdater: Updater<PaginationState> = old => {
|
|
170
|
+
const newState = functionalUpdate(old, updater)
|
|
171
|
+
|
|
172
|
+
if (!instance.options.paginateRowsFn) {
|
|
173
|
+
return {
|
|
174
|
+
...old,
|
|
175
|
+
pageCount: instance.getPreExpandedRows()?.length
|
|
176
|
+
? Math.ceil(
|
|
177
|
+
instance.getPreExpandedRows().length /
|
|
178
|
+
instance.getState().pagination.pageSize
|
|
179
|
+
)
|
|
180
|
+
: 0,
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
return old
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
return instance.options.onPaginationChange?.(
|
|
188
|
+
safeUpdater,
|
|
189
|
+
functionalUpdate(safeUpdater, instance.getState().pagination)
|
|
190
|
+
)
|
|
191
|
+
},
|
|
192
|
+
resetPagination: () => {
|
|
193
|
+
instance.setPagination(
|
|
194
|
+
instance.initialState.pagination ?? {
|
|
195
|
+
pageIndex: 0,
|
|
196
|
+
pageSize: 10,
|
|
197
|
+
pageCount: -1,
|
|
198
|
+
}
|
|
199
|
+
)
|
|
200
|
+
},
|
|
201
|
+
setPageIndex: updater => {
|
|
202
|
+
instance.setPagination(old => {
|
|
203
|
+
const newPageIndex = functionalUpdate(updater, old.pageIndex)
|
|
204
|
+
const maxPageIndex =
|
|
205
|
+
old.pageCount > 0 ? old.pageCount - 1 : Number.MAX_SAFE_INTEGER
|
|
206
|
+
|
|
207
|
+
return {
|
|
208
|
+
...old,
|
|
209
|
+
pageIndex: Math.min(Math.max(0, newPageIndex), maxPageIndex),
|
|
210
|
+
}
|
|
211
|
+
})
|
|
212
|
+
},
|
|
213
|
+
resetPageIndex: () => {
|
|
214
|
+
instance.setPageIndex(0)
|
|
215
|
+
},
|
|
216
|
+
resetPageSize: () => {
|
|
217
|
+
instance.setPageSize(
|
|
218
|
+
instance.options.initialState?.pagination?.pageSize ?? 10
|
|
219
|
+
)
|
|
220
|
+
},
|
|
221
|
+
setPageSize: updater => {
|
|
222
|
+
instance.setPagination(old => {
|
|
223
|
+
const pageSize = Math.max(1, functionalUpdate(updater, old.pageSize))
|
|
224
|
+
const topRowIndex = old.pageSize * old.pageIndex!
|
|
225
|
+
const pageIndex = Math.floor(topRowIndex / pageSize)
|
|
226
|
+
|
|
227
|
+
return {
|
|
228
|
+
...old,
|
|
229
|
+
pageIndex,
|
|
230
|
+
pageSize,
|
|
231
|
+
}
|
|
232
|
+
})
|
|
233
|
+
},
|
|
234
|
+
setPageCount: updater =>
|
|
235
|
+
instance.setPagination(old => ({
|
|
236
|
+
...old,
|
|
237
|
+
pageCount: Math.max(-1, functionalUpdate(updater, old.pageCount)),
|
|
238
|
+
})),
|
|
239
|
+
|
|
240
|
+
getPageOptions: memo(
|
|
241
|
+
() => [
|
|
242
|
+
instance.getState().pagination.pageSize,
|
|
243
|
+
instance.getState().pagination.pageCount,
|
|
244
|
+
],
|
|
245
|
+
(pageSize, pageCount) => {
|
|
246
|
+
let pageOptions: number[] = []
|
|
247
|
+
if (pageCount > 0) {
|
|
248
|
+
pageOptions = [...new Array(pageCount)].fill(null).map((_, i) => i)
|
|
249
|
+
}
|
|
250
|
+
return pageOptions
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
key: 'getPageOptions',
|
|
254
|
+
debug: instance.options.debug,
|
|
255
|
+
}
|
|
256
|
+
),
|
|
257
|
+
|
|
258
|
+
getCanPreviousPage: () => instance.getState().pagination.pageIndex > 0,
|
|
259
|
+
|
|
260
|
+
getCanNextPage: () => {
|
|
261
|
+
const { pageIndex, pageCount, pageSize } = instance.getState().pagination
|
|
262
|
+
|
|
263
|
+
if (pageCount === -1) {
|
|
264
|
+
return true
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
if (pageCount === 0) {
|
|
268
|
+
return false
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
return (
|
|
272
|
+
pageIndex <
|
|
273
|
+
Math.ceil(instance.getPrePaginationRows().length / pageSize) - 1
|
|
274
|
+
)
|
|
275
|
+
},
|
|
276
|
+
|
|
277
|
+
gotoPreviousPage: () => {
|
|
278
|
+
return instance.setPageIndex?.(old => old! - 1)
|
|
279
|
+
},
|
|
280
|
+
|
|
281
|
+
gotoNextPage: () => {
|
|
282
|
+
return instance.setPageIndex?.(old => old! + 1)
|
|
283
|
+
},
|
|
284
|
+
|
|
285
|
+
getPaginationRowModel: memo(
|
|
286
|
+
() => [
|
|
287
|
+
instance.getState().pagination,
|
|
288
|
+
instance.getExpandedRowModel(),
|
|
289
|
+
instance.options.paginateRowsFn,
|
|
290
|
+
],
|
|
291
|
+
(_pagination, rowModel, paginateRowsFn) => {
|
|
292
|
+
if (!paginateRowsFn || !rowModel.rows.length) {
|
|
293
|
+
return rowModel
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
if (process.env.NODE_ENV !== 'production' && instance.options.debug)
|
|
297
|
+
console.info('Paginating...')
|
|
298
|
+
|
|
299
|
+
return paginateRowsFn(instance, rowModel)
|
|
300
|
+
},
|
|
301
|
+
{
|
|
302
|
+
key: 'getPaginationRowModel',
|
|
303
|
+
debug: instance.options.debug,
|
|
304
|
+
}
|
|
305
|
+
),
|
|
306
|
+
|
|
307
|
+
getPrePaginationRows: () => instance.getExpandedRowModel().rows,
|
|
308
|
+
getPrePaginationFlatRows: () => instance.getExpandedRowModel().flatRows,
|
|
309
|
+
getPrePaginationRowsById: () => instance.getExpandedRowModel().rowsById,
|
|
310
|
+
getPaginationRows: () => instance.getPaginationRowModel().rows,
|
|
311
|
+
getPaginationFlatRows: () => instance.getPaginationRowModel().flatRows,
|
|
312
|
+
getPaginationRowsById: () => instance.getPaginationRowModel().rowsById,
|
|
313
|
+
}
|
|
314
|
+
}
|
package/src/features/Pinning.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { OnChangeFn, Updater, ReactTable, Column } from '../types'
|
|
2
2
|
import { functionalUpdate, makeStateUpdater } from '../utils'
|
|
3
3
|
|
|
4
|
-
type ColumnPinningPosition =
|
|
4
|
+
type ColumnPinningPosition = false | 'left' | 'right'
|
|
5
5
|
|
|
6
6
|
export type ColumnPinningState = {
|
|
7
7
|
left?: string[]
|
|
@@ -29,7 +29,7 @@ export type ColumnPinningColumnDef = {
|
|
|
29
29
|
export type ColumnPinningColumn = {
|
|
30
30
|
getCanPin: () => boolean
|
|
31
31
|
getPinnedIndex: () => number
|
|
32
|
-
getIsPinned: () =>
|
|
32
|
+
getIsPinned: () => ColumnPinningPosition
|
|
33
33
|
pin: (position: ColumnPinningPosition) => void
|
|
34
34
|
}
|
|
35
35
|
|
|
@@ -44,7 +44,7 @@ export type ColumnPinningInstance<
|
|
|
44
44
|
resetColumnPinning: () => void
|
|
45
45
|
pinColumn: (columnId: string, position: ColumnPinningPosition) => void
|
|
46
46
|
getColumnCanPin: (columnId: string) => boolean
|
|
47
|
-
getColumnIsPinned: (columnId: string) =>
|
|
47
|
+
getColumnIsPinned: (columnId: string) => ColumnPinningPosition
|
|
48
48
|
getColumnPinnedIndex: (columnId: string) => number
|
|
49
49
|
}
|
|
50
50
|
|
|
@@ -186,25 +186,12 @@ export function getInstance<
|
|
|
186
186
|
const isLeft = leafColumnIds.some(d => left?.includes(d))
|
|
187
187
|
const isRight = leafColumnIds.some(d => right?.includes(d))
|
|
188
188
|
|
|
189
|
-
if (isLeft && isRight) {
|
|
190
|
-
return 'both'
|
|
191
|
-
}
|
|
192
|
-
|
|
193
189
|
return isLeft ? 'left' : isRight ? 'right' : false
|
|
194
190
|
},
|
|
195
191
|
|
|
196
192
|
getColumnPinnedIndex: columnId => {
|
|
197
193
|
const position = instance.getColumnIsPinned(columnId)
|
|
198
194
|
|
|
199
|
-
if (position === 'both') {
|
|
200
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
201
|
-
console.warn(
|
|
202
|
-
`Column ${columnId} has leaf columns that are pinned on both sides`
|
|
203
|
-
)
|
|
204
|
-
}
|
|
205
|
-
throw new Error()
|
|
206
|
-
}
|
|
207
|
-
|
|
208
195
|
return position
|
|
209
196
|
? instance.getState().columnPinning?.[position]?.indexOf(columnId) ?? -1
|
|
210
197
|
: 0
|