@tanstack/table-core 8.17.3 → 9.0.0-alpha.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/dist/cjs/aggregationFns.cjs +98 -0
- package/dist/cjs/aggregationFns.cjs.map +1 -0
- package/dist/cjs/aggregationFns.d.cts +14 -0
- package/dist/cjs/columnHelper.cjs +19 -0
- package/dist/cjs/columnHelper.cjs.map +1 -0
- package/dist/cjs/columnHelper.d.cts +9 -0
- package/dist/cjs/core/cell.cjs +38 -0
- package/dist/cjs/core/cell.cjs.map +1 -0
- package/dist/cjs/core/cell.d.cts +50 -0
- package/dist/cjs/core/column.cjs +81 -0
- package/dist/cjs/core/column.cjs.map +1 -0
- package/dist/cjs/core/column.d.cts +56 -0
- package/dist/cjs/core/headers.cjs +310 -0
- package/dist/cjs/core/headers.cjs.map +1 -0
- package/dist/cjs/core/headers.d.cts +195 -0
- package/dist/cjs/core/row.cjs +93 -0
- package/dist/cjs/core/row.cjs.map +1 -0
- package/dist/cjs/core/row.d.cts +92 -0
- package/dist/cjs/core/table.cjs +228 -0
- package/dist/cjs/core/table.cjs.map +1 -0
- package/dist/cjs/core/table.d.cts +221 -0
- package/dist/cjs/features/ColumnFaceting.cjs +29 -0
- package/dist/cjs/features/ColumnFaceting.cjs.map +1 -0
- package/dist/cjs/features/ColumnFaceting.d.cts +35 -0
- package/dist/cjs/features/ColumnFiltering.cjs +137 -0
- package/dist/cjs/features/ColumnFiltering.cjs.map +1 -0
- package/dist/cjs/features/ColumnFiltering.d.cts +195 -0
- package/dist/cjs/features/ColumnGrouping.cjs +134 -0
- package/dist/cjs/features/ColumnGrouping.cjs.map +1 -0
- package/dist/cjs/features/ColumnGrouping.d.cts +202 -0
- package/dist/cjs/features/ColumnOrdering.cjs +76 -0
- package/dist/cjs/features/ColumnOrdering.cjs.map +1 -0
- package/dist/cjs/features/ColumnOrdering.d.cts +54 -0
- package/dist/cjs/features/ColumnPinning.cjs +145 -0
- package/dist/cjs/features/ColumnPinning.cjs.map +1 -0
- package/dist/cjs/features/ColumnPinning.d.cts +127 -0
- package/dist/cjs/features/ColumnSizing.cjs +308 -0
- package/dist/cjs/features/ColumnSizing.cjs.map +1 -0
- package/dist/cjs/features/ColumnSizing.d.cts +194 -0
- package/dist/cjs/features/ColumnVisibility.cjs +144 -0
- package/dist/cjs/features/ColumnVisibility.cjs.map +1 -0
- package/dist/cjs/features/ColumnVisibility.d.cts +130 -0
- package/dist/cjs/features/GlobalFaceting.cjs +29 -0
- package/dist/cjs/features/GlobalFaceting.cjs.map +1 -0
- package/dist/cjs/features/GlobalFaceting.d.cts +27 -0
- package/dist/cjs/features/GlobalFiltering.cjs +50 -0
- package/dist/cjs/features/GlobalFiltering.cjs.map +1 -0
- package/dist/cjs/features/GlobalFiltering.d.cts +80 -0
- package/dist/cjs/features/RowExpanding.cjs +154 -0
- package/dist/cjs/features/RowExpanding.cjs.map +1 -0
- package/dist/cjs/features/RowExpanding.d.cts +155 -0
- package/dist/cjs/features/RowPagination.cjs +162 -0
- package/dist/cjs/features/RowPagination.cjs.map +1 -0
- package/dist/cjs/features/RowPagination.d.cts +166 -0
- package/dist/cjs/features/RowPinning.cjs +133 -0
- package/dist/cjs/features/RowPinning.cjs.map +1 -0
- package/dist/cjs/features/RowPinning.d.cts +99 -0
- package/dist/cjs/features/RowSelection.cjs +298 -0
- package/dist/cjs/features/RowSelection.cjs.map +1 -0
- package/dist/cjs/features/RowSelection.d.cts +177 -0
- package/dist/cjs/features/RowSorting.cjs +201 -0
- package/dist/cjs/features/RowSorting.cjs.map +1 -0
- package/dist/cjs/features/RowSorting.d.cts +238 -0
- package/dist/cjs/filterFns.cjs +88 -0
- package/dist/cjs/filterFns.cjs.map +1 -0
- package/dist/cjs/filterFns.d.cts +14 -0
- package/{build/lib/index.js → dist/cjs/index.cjs} +36 -49
- package/dist/cjs/index.cjs.map +1 -0
- package/dist/cjs/index.d.cts +34 -0
- package/{build/lib/sortingFns.js → dist/cjs/sortingFns.cjs} +23 -52
- package/dist/cjs/sortingFns.cjs.map +1 -0
- package/dist/cjs/sortingFns.d.cts +12 -0
- package/dist/cjs/types.d.cts +120 -0
- package/{build/lib/utils/filterRowsUtils.js → dist/cjs/utils/filterRowsUtils.cjs} +34 -46
- package/dist/cjs/utils/filterRowsUtils.cjs.map +1 -0
- package/dist/cjs/utils/filterRowsUtils.d.cts +3 -0
- package/dist/cjs/utils/getCoreRowModel.cjs +54 -0
- package/dist/cjs/utils/getCoreRowModel.cjs.map +1 -0
- package/dist/cjs/utils/getCoreRowModel.d.cts +3 -0
- package/dist/cjs/utils/getExpandedRowModel.cjs +41 -0
- package/dist/cjs/utils/getExpandedRowModel.cjs.map +1 -0
- package/dist/cjs/utils/getExpandedRowModel.d.cts +8 -0
- package/dist/cjs/utils/getFacetedMinMaxValues.cjs +36 -0
- package/dist/cjs/utils/getFacetedMinMaxValues.cjs.map +1 -0
- package/dist/cjs/utils/getFacetedMinMaxValues.d.cts +3 -0
- package/dist/cjs/utils/getFacetedRowModel.cjs +35 -0
- package/dist/cjs/utils/getFacetedRowModel.cjs.map +1 -0
- package/dist/cjs/utils/getFacetedRowModel.d.cts +3 -0
- package/dist/cjs/utils/getFacetedUniqueValues.cjs +38 -0
- package/dist/cjs/utils/getFacetedUniqueValues.cjs.map +1 -0
- package/dist/cjs/utils/getFacetedUniqueValues.d.cts +3 -0
- package/dist/cjs/utils/getFilteredRowModel.cjs +116 -0
- package/dist/cjs/utils/getFilteredRowModel.cjs.map +1 -0
- package/dist/cjs/utils/getFilteredRowModel.d.cts +3 -0
- package/dist/cjs/utils/getGroupedRowModel.cjs +118 -0
- package/dist/cjs/utils/getGroupedRowModel.cjs.map +1 -0
- package/dist/cjs/utils/getGroupedRowModel.d.cts +3 -0
- package/dist/cjs/utils/getPaginationRowModel.cjs +49 -0
- package/dist/cjs/utils/getPaginationRowModel.cjs.map +1 -0
- package/dist/cjs/utils/getPaginationRowModel.d.cts +5 -0
- package/dist/cjs/utils/getSortedRowModel.cjs +91 -0
- package/dist/cjs/utils/getSortedRowModel.cjs.map +1 -0
- package/dist/cjs/utils/getSortedRowModel.d.cts +3 -0
- package/{build/lib/utils.js → dist/cjs/utils.cjs} +30 -41
- package/dist/cjs/utils.cjs.map +1 -0
- package/dist/cjs/utils.d.cts +39 -0
- package/{build/lib → dist/esm}/aggregationFns.d.ts +2 -1
- package/dist/esm/aggregationFns.js +98 -0
- package/dist/esm/aggregationFns.js.map +1 -0
- package/{build/lib → dist/esm}/columnHelper.d.ts +3 -2
- package/dist/esm/columnHelper.js +19 -0
- package/{build/lib → dist/esm}/columnHelper.js.map +1 -1
- package/{build/lib → dist/esm}/core/cell.d.ts +1 -0
- package/dist/esm/core/cell.js +38 -0
- package/{build/lib → dist/esm}/core/cell.js.map +1 -1
- package/{build/lib → dist/esm}/core/column.d.ts +1 -0
- package/dist/esm/core/column.js +81 -0
- package/{build/lib → dist/esm}/core/column.js.map +1 -1
- package/{build/lib → dist/esm}/core/headers.d.ts +1 -0
- package/dist/esm/core/headers.js +310 -0
- package/{build/lib → dist/esm}/core/headers.js.map +1 -1
- package/{build/lib → dist/esm}/core/row.d.ts +1 -0
- package/dist/esm/core/row.js +93 -0
- package/{build/lib → dist/esm}/core/row.js.map +1 -1
- package/{build/lib → dist/esm}/core/table.d.ts +1 -0
- package/dist/esm/core/table.js +228 -0
- package/{build/lib → dist/esm}/core/table.js.map +1 -1
- package/{build/lib → dist/esm}/features/ColumnFaceting.d.ts +1 -0
- package/{build/lib → dist/esm}/features/ColumnFaceting.js +5 -18
- package/{build/lib → dist/esm}/features/ColumnFaceting.js.map +1 -1
- package/{build/lib → dist/esm}/features/ColumnFiltering.d.ts +1 -0
- package/dist/esm/features/ColumnFiltering.js +137 -0
- package/{build/lib → dist/esm}/features/ColumnFiltering.js.map +1 -1
- package/{build/lib → dist/esm}/features/ColumnGrouping.d.ts +1 -0
- package/dist/esm/features/ColumnGrouping.js +134 -0
- package/{build/lib → dist/esm}/features/ColumnGrouping.js.map +1 -1
- package/{build/lib → dist/esm}/features/ColumnOrdering.d.ts +1 -0
- package/dist/esm/features/ColumnOrdering.js +76 -0
- package/{build/lib → dist/esm}/features/ColumnOrdering.js.map +1 -1
- package/{build/lib → dist/esm}/features/ColumnPinning.d.ts +1 -0
- package/dist/esm/features/ColumnPinning.js +145 -0
- package/{build/lib → dist/esm}/features/ColumnPinning.js.map +1 -1
- package/{build/lib → dist/esm}/features/ColumnSizing.d.ts +2 -1
- package/dist/esm/features/ColumnSizing.js +308 -0
- package/{build/lib → dist/esm}/features/ColumnSizing.js.map +1 -1
- package/{build/lib → dist/esm}/features/ColumnVisibility.d.ts +1 -0
- package/dist/esm/features/ColumnVisibility.js +144 -0
- package/{build/lib → dist/esm}/features/ColumnVisibility.js.map +1 -1
- package/{build/lib → dist/esm}/features/GlobalFaceting.d.ts +1 -0
- package/{build/lib → dist/esm}/features/GlobalFaceting.js +8 -21
- package/{build/lib → dist/esm}/features/GlobalFaceting.js.map +1 -1
- package/{build/lib → dist/esm}/features/GlobalFiltering.d.ts +1 -0
- package/dist/esm/features/GlobalFiltering.js +50 -0
- package/{build/lib → dist/esm}/features/GlobalFiltering.js.map +1 -1
- package/{build/lib → dist/esm}/features/RowExpanding.d.ts +1 -0
- package/{build/lib → dist/esm}/features/RowExpanding.js +40 -59
- package/{build/lib → dist/esm}/features/RowExpanding.js.map +1 -1
- package/{build/lib → dist/esm}/features/RowPagination.d.ts +1 -0
- package/dist/esm/features/RowPagination.js +162 -0
- package/{build/lib → dist/esm}/features/RowPagination.js.map +1 -1
- package/{build/lib → dist/esm}/features/RowPinning.d.ts +1 -0
- package/dist/esm/features/RowPinning.js +133 -0
- package/{build/lib → dist/esm}/features/RowPinning.js.map +1 -1
- package/{build/lib → dist/esm}/features/RowSelection.d.ts +1 -0
- package/dist/esm/features/RowSelection.js +298 -0
- package/{build/lib → dist/esm}/features/RowSelection.js.map +1 -1
- package/{build/lib → dist/esm}/features/RowSorting.d.ts +1 -0
- package/dist/esm/features/RowSorting.js +201 -0
- package/{build/lib → dist/esm}/features/RowSorting.js.map +1 -1
- package/{build/lib → dist/esm}/filterFns.d.ts +2 -1
- package/dist/esm/filterFns.js +88 -0
- package/dist/esm/filterFns.js.map +1 -0
- package/dist/esm/index.d.ts +34 -0
- package/dist/esm/index.js +87 -0
- package/dist/esm/index.js.map +1 -0
- package/{build/lib → dist/esm}/sortingFns.d.ts +2 -1
- package/dist/esm/sortingFns.js +91 -0
- package/dist/esm/sortingFns.js.map +1 -0
- package/{build/lib → dist/esm}/types.d.ts +21 -20
- package/{build/lib → dist/esm}/utils/filterRowsUtils.d.ts +1 -0
- package/dist/esm/utils/filterRowsUtils.js +99 -0
- package/dist/esm/utils/filterRowsUtils.js.map +1 -0
- package/{build/lib → dist/esm}/utils/getCoreRowModel.d.ts +1 -0
- package/dist/esm/utils/getCoreRowModel.js +54 -0
- package/{build/lib → dist/esm}/utils/getCoreRowModel.js.map +1 -1
- package/{build/lib → dist/esm}/utils/getExpandedRowModel.d.ts +1 -0
- package/dist/esm/utils/getExpandedRowModel.js +41 -0
- package/dist/esm/utils/getExpandedRowModel.js.map +1 -0
- package/{build/lib → dist/esm}/utils/getFacetedMinMaxValues.d.ts +1 -0
- package/dist/esm/utils/getFacetedMinMaxValues.js +36 -0
- package/dist/esm/utils/getFacetedMinMaxValues.js.map +1 -0
- package/{build/lib → dist/esm}/utils/getFacetedRowModel.d.ts +1 -0
- package/dist/esm/utils/getFacetedRowModel.js +35 -0
- package/{build/lib → dist/esm}/utils/getFacetedRowModel.js.map +1 -1
- package/{build/lib → dist/esm}/utils/getFacetedUniqueValues.d.ts +1 -0
- package/dist/esm/utils/getFacetedUniqueValues.js +38 -0
- package/dist/esm/utils/getFacetedUniqueValues.js.map +1 -0
- package/{build/lib → dist/esm}/utils/getFilteredRowModel.d.ts +1 -0
- package/dist/esm/utils/getFilteredRowModel.js +116 -0
- package/{build/lib → dist/esm}/utils/getFilteredRowModel.js.map +1 -1
- package/{build/lib → dist/esm}/utils/getGroupedRowModel.d.ts +1 -0
- package/dist/esm/utils/getGroupedRowModel.js +118 -0
- package/{build/lib → dist/esm}/utils/getGroupedRowModel.js.map +1 -1
- package/{build/lib → dist/esm}/utils/getPaginationRowModel.d.ts +1 -0
- package/dist/esm/utils/getPaginationRowModel.js +49 -0
- package/dist/esm/utils/getPaginationRowModel.js.map +1 -0
- package/{build/lib → dist/esm}/utils/getSortedRowModel.d.ts +1 -0
- package/dist/esm/utils/getSortedRowModel.js +91 -0
- package/{build/lib → dist/esm}/utils/getSortedRowModel.js.map +1 -1
- package/{build/lib → dist/esm}/utils.d.ts +2 -1
- package/dist/esm/utils.js +100 -0
- package/{build/lib → dist/esm}/utils.js.map +1 -1
- package/package.json +15 -19
- package/build/lib/aggregationFns.js +0 -108
- package/build/lib/aggregationFns.js.map +0 -1
- package/build/lib/columnHelper.js +0 -71
- package/build/lib/core/cell.js +0 -42
- package/build/lib/core/column.js +0 -80
- package/build/lib/core/headers.js +0 -270
- package/build/lib/core/row.js +0 -89
- package/build/lib/core/table.js +0 -212
- package/build/lib/features/ColumnFiltering.js +0 -151
- package/build/lib/features/ColumnGrouping.js +0 -142
- package/build/lib/features/ColumnOrdering.js +0 -84
- package/build/lib/features/ColumnPinning.js +0 -130
- package/build/lib/features/ColumnSizing.js +0 -270
- package/build/lib/features/ColumnVisibility.js +0 -99
- package/build/lib/features/GlobalFiltering.js +0 -63
- package/build/lib/features/RowPagination.js +0 -169
- package/build/lib/features/RowPinning.js +0 -145
- package/build/lib/features/RowSelection.js +0 -391
- package/build/lib/features/RowSorting.js +0 -226
- package/build/lib/filterFns.js +0 -96
- package/build/lib/filterFns.js.map +0 -1
- package/build/lib/index.d.ts +0 -34
- package/build/lib/index.esm.js +0 -3522
- package/build/lib/index.esm.js.map +0 -1
- package/build/lib/index.js.map +0 -1
- package/build/lib/index.mjs +0 -3522
- package/build/lib/index.mjs.map +0 -1
- package/build/lib/sortingFns.js.map +0 -1
- package/build/lib/utils/filterRowsUtils.js.map +0 -1
- package/build/lib/utils/getCoreRowModel.js +0 -65
- package/build/lib/utils/getExpandedRowModel.js +0 -46
- package/build/lib/utils/getExpandedRowModel.js.map +0 -1
- package/build/lib/utils/getFacetedMinMaxValues.js +0 -43
- package/build/lib/utils/getFacetedMinMaxValues.js.map +0 -1
- package/build/lib/utils/getFacetedRowModel.js +0 -36
- package/build/lib/utils/getFacetedUniqueValues.js +0 -39
- package/build/lib/utils/getFacetedUniqueValues.js.map +0 -1
- package/build/lib/utils/getFilteredRowModel.js +0 -111
- package/build/lib/utils/getGroupedRowModel.js +0 -150
- package/build/lib/utils/getPaginationRowModel.js +0 -60
- package/build/lib/utils/getPaginationRowModel.js.map +0 -1
- package/build/lib/utils/getSortedRowModel.js +0 -102
- package/build/umd/index.development.js +0 -3578
- package/build/umd/index.development.js.map +0 -1
- package/build/umd/index.production.js +0 -12
- package/build/umd/index.production.js.map +0 -1
|
@@ -1,270 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* table-core
|
|
3
|
-
*
|
|
4
|
-
* Copyright (c) TanStack
|
|
5
|
-
*
|
|
6
|
-
* This source code is licensed under the MIT license found in the
|
|
7
|
-
* LICENSE.md file in the root directory of this source tree.
|
|
8
|
-
*
|
|
9
|
-
* @license MIT
|
|
10
|
-
*/
|
|
11
|
-
'use strict';
|
|
12
|
-
|
|
13
|
-
var utils = require('../utils.js');
|
|
14
|
-
var ColumnVisibility = require('./ColumnVisibility.js');
|
|
15
|
-
|
|
16
|
-
//
|
|
17
|
-
|
|
18
|
-
//
|
|
19
|
-
|
|
20
|
-
const defaultColumnSizing = {
|
|
21
|
-
size: 150,
|
|
22
|
-
minSize: 20,
|
|
23
|
-
maxSize: Number.MAX_SAFE_INTEGER
|
|
24
|
-
};
|
|
25
|
-
const getDefaultColumnSizingInfoState = () => ({
|
|
26
|
-
startOffset: null,
|
|
27
|
-
startSize: null,
|
|
28
|
-
deltaOffset: null,
|
|
29
|
-
deltaPercentage: null,
|
|
30
|
-
isResizingColumn: false,
|
|
31
|
-
columnSizingStart: []
|
|
32
|
-
});
|
|
33
|
-
const ColumnSizing = {
|
|
34
|
-
getDefaultColumnDef: () => {
|
|
35
|
-
return defaultColumnSizing;
|
|
36
|
-
},
|
|
37
|
-
getInitialState: state => {
|
|
38
|
-
return {
|
|
39
|
-
columnSizing: {},
|
|
40
|
-
columnSizingInfo: getDefaultColumnSizingInfoState(),
|
|
41
|
-
...state
|
|
42
|
-
};
|
|
43
|
-
},
|
|
44
|
-
getDefaultOptions: table => {
|
|
45
|
-
return {
|
|
46
|
-
columnResizeMode: 'onEnd',
|
|
47
|
-
columnResizeDirection: 'ltr',
|
|
48
|
-
onColumnSizingChange: utils.makeStateUpdater('columnSizing', table),
|
|
49
|
-
onColumnSizingInfoChange: utils.makeStateUpdater('columnSizingInfo', table)
|
|
50
|
-
};
|
|
51
|
-
},
|
|
52
|
-
createColumn: (column, table) => {
|
|
53
|
-
column.getSize = () => {
|
|
54
|
-
var _column$columnDef$min, _ref, _column$columnDef$max;
|
|
55
|
-
const columnSize = table.getState().columnSizing[column.id];
|
|
56
|
-
return Math.min(Math.max((_column$columnDef$min = column.columnDef.minSize) != null ? _column$columnDef$min : defaultColumnSizing.minSize, (_ref = columnSize != null ? columnSize : column.columnDef.size) != null ? _ref : defaultColumnSizing.size), (_column$columnDef$max = column.columnDef.maxSize) != null ? _column$columnDef$max : defaultColumnSizing.maxSize);
|
|
57
|
-
};
|
|
58
|
-
column.getStart = utils.memo(position => [position, ColumnVisibility._getVisibleLeafColumns(table, position), table.getState().columnSizing], (position, columns) => columns.slice(0, column.getIndex(position)).reduce((sum, column) => sum + column.getSize(), 0), utils.getMemoOptions(table.options, 'debugColumns', 'getStart'));
|
|
59
|
-
column.getAfter = utils.memo(position => [position, ColumnVisibility._getVisibleLeafColumns(table, position), table.getState().columnSizing], (position, columns) => columns.slice(column.getIndex(position) + 1).reduce((sum, column) => sum + column.getSize(), 0), utils.getMemoOptions(table.options, 'debugColumns', 'getAfter'));
|
|
60
|
-
column.resetSize = () => {
|
|
61
|
-
table.setColumnSizing(_ref2 => {
|
|
62
|
-
let {
|
|
63
|
-
[column.id]: _,
|
|
64
|
-
...rest
|
|
65
|
-
} = _ref2;
|
|
66
|
-
return rest;
|
|
67
|
-
});
|
|
68
|
-
};
|
|
69
|
-
column.getCanResize = () => {
|
|
70
|
-
var _column$columnDef$ena, _table$options$enable;
|
|
71
|
-
return ((_column$columnDef$ena = column.columnDef.enableResizing) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table.options.enableColumnResizing) != null ? _table$options$enable : true);
|
|
72
|
-
};
|
|
73
|
-
column.getIsResizing = () => {
|
|
74
|
-
return table.getState().columnSizingInfo.isResizingColumn === column.id;
|
|
75
|
-
};
|
|
76
|
-
},
|
|
77
|
-
createHeader: (header, table) => {
|
|
78
|
-
header.getSize = () => {
|
|
79
|
-
let sum = 0;
|
|
80
|
-
const recurse = header => {
|
|
81
|
-
if (header.subHeaders.length) {
|
|
82
|
-
header.subHeaders.forEach(recurse);
|
|
83
|
-
} else {
|
|
84
|
-
var _header$column$getSiz;
|
|
85
|
-
sum += (_header$column$getSiz = header.column.getSize()) != null ? _header$column$getSiz : 0;
|
|
86
|
-
}
|
|
87
|
-
};
|
|
88
|
-
recurse(header);
|
|
89
|
-
return sum;
|
|
90
|
-
};
|
|
91
|
-
header.getStart = () => {
|
|
92
|
-
if (header.index > 0) {
|
|
93
|
-
const prevSiblingHeader = header.headerGroup.headers[header.index - 1];
|
|
94
|
-
return prevSiblingHeader.getStart() + prevSiblingHeader.getSize();
|
|
95
|
-
}
|
|
96
|
-
return 0;
|
|
97
|
-
};
|
|
98
|
-
header.getResizeHandler = _contextDocument => {
|
|
99
|
-
const column = table.getColumn(header.column.id);
|
|
100
|
-
const canResize = column == null ? void 0 : column.getCanResize();
|
|
101
|
-
return e => {
|
|
102
|
-
if (!column || !canResize) {
|
|
103
|
-
return;
|
|
104
|
-
}
|
|
105
|
-
e.persist == null || e.persist();
|
|
106
|
-
if (isTouchStartEvent(e)) {
|
|
107
|
-
// lets not respond to multiple touches (e.g. 2 or 3 fingers)
|
|
108
|
-
if (e.touches && e.touches.length > 1) {
|
|
109
|
-
return;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
const startSize = header.getSize();
|
|
113
|
-
const columnSizingStart = header ? header.getLeafHeaders().map(d => [d.column.id, d.column.getSize()]) : [[column.id, column.getSize()]];
|
|
114
|
-
const clientX = isTouchStartEvent(e) ? Math.round(e.touches[0].clientX) : e.clientX;
|
|
115
|
-
const newColumnSizing = {};
|
|
116
|
-
const updateOffset = (eventType, clientXPos) => {
|
|
117
|
-
if (typeof clientXPos !== 'number') {
|
|
118
|
-
return;
|
|
119
|
-
}
|
|
120
|
-
table.setColumnSizingInfo(old => {
|
|
121
|
-
var _old$startOffset, _old$startSize;
|
|
122
|
-
const deltaDirection = table.options.columnResizeDirection === 'rtl' ? -1 : 1;
|
|
123
|
-
const deltaOffset = (clientXPos - ((_old$startOffset = old == null ? void 0 : old.startOffset) != null ? _old$startOffset : 0)) * deltaDirection;
|
|
124
|
-
const deltaPercentage = Math.max(deltaOffset / ((_old$startSize = old == null ? void 0 : old.startSize) != null ? _old$startSize : 0), -0.999999);
|
|
125
|
-
old.columnSizingStart.forEach(_ref3 => {
|
|
126
|
-
let [columnId, headerSize] = _ref3;
|
|
127
|
-
newColumnSizing[columnId] = Math.round(Math.max(headerSize + headerSize * deltaPercentage, 0) * 100) / 100;
|
|
128
|
-
});
|
|
129
|
-
return {
|
|
130
|
-
...old,
|
|
131
|
-
deltaOffset,
|
|
132
|
-
deltaPercentage
|
|
133
|
-
};
|
|
134
|
-
});
|
|
135
|
-
if (table.options.columnResizeMode === 'onChange' || eventType === 'end') {
|
|
136
|
-
table.setColumnSizing(old => ({
|
|
137
|
-
...old,
|
|
138
|
-
...newColumnSizing
|
|
139
|
-
}));
|
|
140
|
-
}
|
|
141
|
-
};
|
|
142
|
-
const onMove = clientXPos => updateOffset('move', clientXPos);
|
|
143
|
-
const onEnd = clientXPos => {
|
|
144
|
-
updateOffset('end', clientXPos);
|
|
145
|
-
table.setColumnSizingInfo(old => ({
|
|
146
|
-
...old,
|
|
147
|
-
isResizingColumn: false,
|
|
148
|
-
startOffset: null,
|
|
149
|
-
startSize: null,
|
|
150
|
-
deltaOffset: null,
|
|
151
|
-
deltaPercentage: null,
|
|
152
|
-
columnSizingStart: []
|
|
153
|
-
}));
|
|
154
|
-
};
|
|
155
|
-
const contextDocument = _contextDocument || typeof document !== 'undefined' ? document : null;
|
|
156
|
-
const mouseEvents = {
|
|
157
|
-
moveHandler: e => onMove(e.clientX),
|
|
158
|
-
upHandler: e => {
|
|
159
|
-
contextDocument == null || contextDocument.removeEventListener('mousemove', mouseEvents.moveHandler);
|
|
160
|
-
contextDocument == null || contextDocument.removeEventListener('mouseup', mouseEvents.upHandler);
|
|
161
|
-
onEnd(e.clientX);
|
|
162
|
-
}
|
|
163
|
-
};
|
|
164
|
-
const touchEvents = {
|
|
165
|
-
moveHandler: e => {
|
|
166
|
-
if (e.cancelable) {
|
|
167
|
-
e.preventDefault();
|
|
168
|
-
e.stopPropagation();
|
|
169
|
-
}
|
|
170
|
-
onMove(e.touches[0].clientX);
|
|
171
|
-
return false;
|
|
172
|
-
},
|
|
173
|
-
upHandler: e => {
|
|
174
|
-
var _e$touches$;
|
|
175
|
-
contextDocument == null || contextDocument.removeEventListener('touchmove', touchEvents.moveHandler);
|
|
176
|
-
contextDocument == null || contextDocument.removeEventListener('touchend', touchEvents.upHandler);
|
|
177
|
-
if (e.cancelable) {
|
|
178
|
-
e.preventDefault();
|
|
179
|
-
e.stopPropagation();
|
|
180
|
-
}
|
|
181
|
-
onEnd((_e$touches$ = e.touches[0]) == null ? void 0 : _e$touches$.clientX);
|
|
182
|
-
}
|
|
183
|
-
};
|
|
184
|
-
const passiveIfSupported = passiveEventSupported() ? {
|
|
185
|
-
passive: false
|
|
186
|
-
} : false;
|
|
187
|
-
if (isTouchStartEvent(e)) {
|
|
188
|
-
contextDocument == null || contextDocument.addEventListener('touchmove', touchEvents.moveHandler, passiveIfSupported);
|
|
189
|
-
contextDocument == null || contextDocument.addEventListener('touchend', touchEvents.upHandler, passiveIfSupported);
|
|
190
|
-
} else {
|
|
191
|
-
contextDocument == null || contextDocument.addEventListener('mousemove', mouseEvents.moveHandler, passiveIfSupported);
|
|
192
|
-
contextDocument == null || contextDocument.addEventListener('mouseup', mouseEvents.upHandler, passiveIfSupported);
|
|
193
|
-
}
|
|
194
|
-
table.setColumnSizingInfo(old => ({
|
|
195
|
-
...old,
|
|
196
|
-
startOffset: clientX,
|
|
197
|
-
startSize,
|
|
198
|
-
deltaOffset: 0,
|
|
199
|
-
deltaPercentage: 0,
|
|
200
|
-
columnSizingStart,
|
|
201
|
-
isResizingColumn: column.id
|
|
202
|
-
}));
|
|
203
|
-
};
|
|
204
|
-
};
|
|
205
|
-
},
|
|
206
|
-
createTable: table => {
|
|
207
|
-
table.setColumnSizing = updater => table.options.onColumnSizingChange == null ? void 0 : table.options.onColumnSizingChange(updater);
|
|
208
|
-
table.setColumnSizingInfo = updater => table.options.onColumnSizingInfoChange == null ? void 0 : table.options.onColumnSizingInfoChange(updater);
|
|
209
|
-
table.resetColumnSizing = defaultState => {
|
|
210
|
-
var _table$initialState$c;
|
|
211
|
-
table.setColumnSizing(defaultState ? {} : (_table$initialState$c = table.initialState.columnSizing) != null ? _table$initialState$c : {});
|
|
212
|
-
};
|
|
213
|
-
table.resetHeaderSizeInfo = defaultState => {
|
|
214
|
-
var _table$initialState$c2;
|
|
215
|
-
table.setColumnSizingInfo(defaultState ? getDefaultColumnSizingInfoState() : (_table$initialState$c2 = table.initialState.columnSizingInfo) != null ? _table$initialState$c2 : getDefaultColumnSizingInfoState());
|
|
216
|
-
};
|
|
217
|
-
table.getTotalSize = () => {
|
|
218
|
-
var _table$getHeaderGroup, _table$getHeaderGroup2;
|
|
219
|
-
return (_table$getHeaderGroup = (_table$getHeaderGroup2 = table.getHeaderGroups()[0]) == null ? void 0 : _table$getHeaderGroup2.headers.reduce((sum, header) => {
|
|
220
|
-
return sum + header.getSize();
|
|
221
|
-
}, 0)) != null ? _table$getHeaderGroup : 0;
|
|
222
|
-
};
|
|
223
|
-
table.getLeftTotalSize = () => {
|
|
224
|
-
var _table$getLeftHeaderG, _table$getLeftHeaderG2;
|
|
225
|
-
return (_table$getLeftHeaderG = (_table$getLeftHeaderG2 = table.getLeftHeaderGroups()[0]) == null ? void 0 : _table$getLeftHeaderG2.headers.reduce((sum, header) => {
|
|
226
|
-
return sum + header.getSize();
|
|
227
|
-
}, 0)) != null ? _table$getLeftHeaderG : 0;
|
|
228
|
-
};
|
|
229
|
-
table.getCenterTotalSize = () => {
|
|
230
|
-
var _table$getCenterHeade, _table$getCenterHeade2;
|
|
231
|
-
return (_table$getCenterHeade = (_table$getCenterHeade2 = table.getCenterHeaderGroups()[0]) == null ? void 0 : _table$getCenterHeade2.headers.reduce((sum, header) => {
|
|
232
|
-
return sum + header.getSize();
|
|
233
|
-
}, 0)) != null ? _table$getCenterHeade : 0;
|
|
234
|
-
};
|
|
235
|
-
table.getRightTotalSize = () => {
|
|
236
|
-
var _table$getRightHeader, _table$getRightHeader2;
|
|
237
|
-
return (_table$getRightHeader = (_table$getRightHeader2 = table.getRightHeaderGroups()[0]) == null ? void 0 : _table$getRightHeader2.headers.reduce((sum, header) => {
|
|
238
|
-
return sum + header.getSize();
|
|
239
|
-
}, 0)) != null ? _table$getRightHeader : 0;
|
|
240
|
-
};
|
|
241
|
-
}
|
|
242
|
-
};
|
|
243
|
-
let passiveSupported = null;
|
|
244
|
-
function passiveEventSupported() {
|
|
245
|
-
if (typeof passiveSupported === 'boolean') return passiveSupported;
|
|
246
|
-
let supported = false;
|
|
247
|
-
try {
|
|
248
|
-
const options = {
|
|
249
|
-
get passive() {
|
|
250
|
-
supported = true;
|
|
251
|
-
return false;
|
|
252
|
-
}
|
|
253
|
-
};
|
|
254
|
-
const noop = () => {};
|
|
255
|
-
window.addEventListener('test', noop, options);
|
|
256
|
-
window.removeEventListener('test', noop);
|
|
257
|
-
} catch (err) {
|
|
258
|
-
supported = false;
|
|
259
|
-
}
|
|
260
|
-
passiveSupported = supported;
|
|
261
|
-
return passiveSupported;
|
|
262
|
-
}
|
|
263
|
-
function isTouchStartEvent(e) {
|
|
264
|
-
return e.type === 'touchstart';
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
exports.ColumnSizing = ColumnSizing;
|
|
268
|
-
exports.defaultColumnSizing = defaultColumnSizing;
|
|
269
|
-
exports.passiveEventSupported = passiveEventSupported;
|
|
270
|
-
//# sourceMappingURL=ColumnSizing.js.map
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* table-core
|
|
3
|
-
*
|
|
4
|
-
* Copyright (c) TanStack
|
|
5
|
-
*
|
|
6
|
-
* This source code is licensed under the MIT license found in the
|
|
7
|
-
* LICENSE.md file in the root directory of this source tree.
|
|
8
|
-
*
|
|
9
|
-
* @license MIT
|
|
10
|
-
*/
|
|
11
|
-
'use strict';
|
|
12
|
-
|
|
13
|
-
var utils = require('../utils.js');
|
|
14
|
-
|
|
15
|
-
//
|
|
16
|
-
|
|
17
|
-
const ColumnVisibility = {
|
|
18
|
-
getInitialState: state => {
|
|
19
|
-
return {
|
|
20
|
-
columnVisibility: {},
|
|
21
|
-
...state
|
|
22
|
-
};
|
|
23
|
-
},
|
|
24
|
-
getDefaultOptions: table => {
|
|
25
|
-
return {
|
|
26
|
-
onColumnVisibilityChange: utils.makeStateUpdater('columnVisibility', table)
|
|
27
|
-
};
|
|
28
|
-
},
|
|
29
|
-
createColumn: (column, table) => {
|
|
30
|
-
column.toggleVisibility = value => {
|
|
31
|
-
if (column.getCanHide()) {
|
|
32
|
-
table.setColumnVisibility(old => ({
|
|
33
|
-
...old,
|
|
34
|
-
[column.id]: value != null ? value : !column.getIsVisible()
|
|
35
|
-
}));
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
column.getIsVisible = () => {
|
|
39
|
-
var _ref, _table$getState$colum;
|
|
40
|
-
const childColumns = column.columns;
|
|
41
|
-
return (_ref = childColumns.length ? childColumns.some(c => c.getIsVisible()) : (_table$getState$colum = table.getState().columnVisibility) == null ? void 0 : _table$getState$colum[column.id]) != null ? _ref : true;
|
|
42
|
-
};
|
|
43
|
-
column.getCanHide = () => {
|
|
44
|
-
var _column$columnDef$ena, _table$options$enable;
|
|
45
|
-
return ((_column$columnDef$ena = column.columnDef.enableHiding) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table.options.enableHiding) != null ? _table$options$enable : true);
|
|
46
|
-
};
|
|
47
|
-
column.getToggleVisibilityHandler = () => {
|
|
48
|
-
return e => {
|
|
49
|
-
column.toggleVisibility == null || column.toggleVisibility(e.target.checked);
|
|
50
|
-
};
|
|
51
|
-
};
|
|
52
|
-
},
|
|
53
|
-
createRow: (row, table) => {
|
|
54
|
-
row._getAllVisibleCells = utils.memo(() => [row.getAllCells(), table.getState().columnVisibility], cells => {
|
|
55
|
-
return cells.filter(cell => cell.column.getIsVisible());
|
|
56
|
-
}, utils.getMemoOptions(table.options, 'debugRows', '_getAllVisibleCells'));
|
|
57
|
-
row.getVisibleCells = utils.memo(() => [row.getLeftVisibleCells(), row.getCenterVisibleCells(), row.getRightVisibleCells()], (left, center, right) => [...left, ...center, ...right], utils.getMemoOptions(table.options, 'debugRows', 'getVisibleCells'));
|
|
58
|
-
},
|
|
59
|
-
createTable: table => {
|
|
60
|
-
const makeVisibleColumnsMethod = (key, getColumns) => {
|
|
61
|
-
return utils.memo(() => [getColumns(), getColumns().filter(d => d.getIsVisible()).map(d => d.id).join('_')], columns => {
|
|
62
|
-
return columns.filter(d => d.getIsVisible == null ? void 0 : d.getIsVisible());
|
|
63
|
-
}, utils.getMemoOptions(table.options, 'debugColumns', key));
|
|
64
|
-
};
|
|
65
|
-
table.getVisibleFlatColumns = makeVisibleColumnsMethod('getVisibleFlatColumns', () => table.getAllFlatColumns());
|
|
66
|
-
table.getVisibleLeafColumns = makeVisibleColumnsMethod('getVisibleLeafColumns', () => table.getAllLeafColumns());
|
|
67
|
-
table.getLeftVisibleLeafColumns = makeVisibleColumnsMethod('getLeftVisibleLeafColumns', () => table.getLeftLeafColumns());
|
|
68
|
-
table.getRightVisibleLeafColumns = makeVisibleColumnsMethod('getRightVisibleLeafColumns', () => table.getRightLeafColumns());
|
|
69
|
-
table.getCenterVisibleLeafColumns = makeVisibleColumnsMethod('getCenterVisibleLeafColumns', () => table.getCenterLeafColumns());
|
|
70
|
-
table.setColumnVisibility = updater => table.options.onColumnVisibilityChange == null ? void 0 : table.options.onColumnVisibilityChange(updater);
|
|
71
|
-
table.resetColumnVisibility = defaultState => {
|
|
72
|
-
var _table$initialState$c;
|
|
73
|
-
table.setColumnVisibility(defaultState ? {} : (_table$initialState$c = table.initialState.columnVisibility) != null ? _table$initialState$c : {});
|
|
74
|
-
};
|
|
75
|
-
table.toggleAllColumnsVisible = value => {
|
|
76
|
-
var _value;
|
|
77
|
-
value = (_value = value) != null ? _value : !table.getIsAllColumnsVisible();
|
|
78
|
-
table.setColumnVisibility(table.getAllLeafColumns().reduce((obj, column) => ({
|
|
79
|
-
...obj,
|
|
80
|
-
[column.id]: !value ? !(column.getCanHide != null && column.getCanHide()) : value
|
|
81
|
-
}), {}));
|
|
82
|
-
};
|
|
83
|
-
table.getIsAllColumnsVisible = () => !table.getAllLeafColumns().some(column => !(column.getIsVisible != null && column.getIsVisible()));
|
|
84
|
-
table.getIsSomeColumnsVisible = () => table.getAllLeafColumns().some(column => column.getIsVisible == null ? void 0 : column.getIsVisible());
|
|
85
|
-
table.getToggleAllColumnsVisibilityHandler = () => {
|
|
86
|
-
return e => {
|
|
87
|
-
var _target;
|
|
88
|
-
table.toggleAllColumnsVisible((_target = e.target) == null ? void 0 : _target.checked);
|
|
89
|
-
};
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
function _getVisibleLeafColumns(table, position) {
|
|
94
|
-
return !position ? table.getVisibleLeafColumns() : position === 'center' ? table.getCenterVisibleLeafColumns() : position === 'left' ? table.getLeftVisibleLeafColumns() : table.getRightVisibleLeafColumns();
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
exports.ColumnVisibility = ColumnVisibility;
|
|
98
|
-
exports._getVisibleLeafColumns = _getVisibleLeafColumns;
|
|
99
|
-
//# sourceMappingURL=ColumnVisibility.js.map
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* table-core
|
|
3
|
-
*
|
|
4
|
-
* Copyright (c) TanStack
|
|
5
|
-
*
|
|
6
|
-
* This source code is licensed under the MIT license found in the
|
|
7
|
-
* LICENSE.md file in the root directory of this source tree.
|
|
8
|
-
*
|
|
9
|
-
* @license MIT
|
|
10
|
-
*/
|
|
11
|
-
'use strict';
|
|
12
|
-
|
|
13
|
-
var filterFns = require('../filterFns.js');
|
|
14
|
-
var utils = require('../utils.js');
|
|
15
|
-
|
|
16
|
-
//
|
|
17
|
-
|
|
18
|
-
const GlobalFiltering = {
|
|
19
|
-
getInitialState: state => {
|
|
20
|
-
return {
|
|
21
|
-
globalFilter: undefined,
|
|
22
|
-
...state
|
|
23
|
-
};
|
|
24
|
-
},
|
|
25
|
-
getDefaultOptions: table => {
|
|
26
|
-
return {
|
|
27
|
-
onGlobalFilterChange: utils.makeStateUpdater('globalFilter', table),
|
|
28
|
-
globalFilterFn: 'auto',
|
|
29
|
-
getColumnCanGlobalFilter: column => {
|
|
30
|
-
var _table$getCoreRowMode;
|
|
31
|
-
const value = (_table$getCoreRowMode = table.getCoreRowModel().flatRows[0]) == null || (_table$getCoreRowMode = _table$getCoreRowMode._getAllCellsByColumnId()[column.id]) == null ? void 0 : _table$getCoreRowMode.getValue();
|
|
32
|
-
return typeof value === 'string' || typeof value === 'number';
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
},
|
|
36
|
-
createColumn: (column, table) => {
|
|
37
|
-
column.getCanGlobalFilter = () => {
|
|
38
|
-
var _column$columnDef$ena, _table$options$enable, _table$options$enable2, _table$options$getCol;
|
|
39
|
-
return ((_column$columnDef$ena = column.columnDef.enableGlobalFilter) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table.options.enableGlobalFilter) != null ? _table$options$enable : true) && ((_table$options$enable2 = table.options.enableFilters) != null ? _table$options$enable2 : true) && ((_table$options$getCol = table.options.getColumnCanGlobalFilter == null ? void 0 : table.options.getColumnCanGlobalFilter(column)) != null ? _table$options$getCol : true) && !!column.accessorFn;
|
|
40
|
-
};
|
|
41
|
-
},
|
|
42
|
-
createTable: table => {
|
|
43
|
-
table.getGlobalAutoFilterFn = () => {
|
|
44
|
-
return filterFns.filterFns.includesString;
|
|
45
|
-
};
|
|
46
|
-
table.getGlobalFilterFn = () => {
|
|
47
|
-
var _table$options$filter, _table$options$filter2;
|
|
48
|
-
const {
|
|
49
|
-
globalFilterFn: globalFilterFn
|
|
50
|
-
} = table.options;
|
|
51
|
-
return utils.isFunction(globalFilterFn) ? globalFilterFn : globalFilterFn === 'auto' ? table.getGlobalAutoFilterFn() : (_table$options$filter = (_table$options$filter2 = table.options.filterFns) == null ? void 0 : _table$options$filter2[globalFilterFn]) != null ? _table$options$filter : filterFns.filterFns[globalFilterFn];
|
|
52
|
-
};
|
|
53
|
-
table.setGlobalFilter = updater => {
|
|
54
|
-
table.options.onGlobalFilterChange == null || table.options.onGlobalFilterChange(updater);
|
|
55
|
-
};
|
|
56
|
-
table.resetGlobalFilter = defaultState => {
|
|
57
|
-
table.setGlobalFilter(defaultState ? undefined : table.initialState.globalFilter);
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
exports.GlobalFiltering = GlobalFiltering;
|
|
63
|
-
//# sourceMappingURL=GlobalFiltering.js.map
|
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* table-core
|
|
3
|
-
*
|
|
4
|
-
* Copyright (c) TanStack
|
|
5
|
-
*
|
|
6
|
-
* This source code is licensed under the MIT license found in the
|
|
7
|
-
* LICENSE.md file in the root directory of this source tree.
|
|
8
|
-
*
|
|
9
|
-
* @license MIT
|
|
10
|
-
*/
|
|
11
|
-
'use strict';
|
|
12
|
-
|
|
13
|
-
var utils = require('../utils.js');
|
|
14
|
-
|
|
15
|
-
//
|
|
16
|
-
|
|
17
|
-
const defaultPageIndex = 0;
|
|
18
|
-
const defaultPageSize = 10;
|
|
19
|
-
const getDefaultPaginationState = () => ({
|
|
20
|
-
pageIndex: defaultPageIndex,
|
|
21
|
-
pageSize: defaultPageSize
|
|
22
|
-
});
|
|
23
|
-
const RowPagination = {
|
|
24
|
-
getInitialState: state => {
|
|
25
|
-
return {
|
|
26
|
-
...state,
|
|
27
|
-
pagination: {
|
|
28
|
-
...getDefaultPaginationState(),
|
|
29
|
-
...(state == null ? void 0 : state.pagination)
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
},
|
|
33
|
-
getDefaultOptions: table => {
|
|
34
|
-
return {
|
|
35
|
-
onPaginationChange: utils.makeStateUpdater('pagination', table)
|
|
36
|
-
};
|
|
37
|
-
},
|
|
38
|
-
createTable: table => {
|
|
39
|
-
let registered = false;
|
|
40
|
-
let queued = false;
|
|
41
|
-
table._autoResetPageIndex = () => {
|
|
42
|
-
var _ref, _table$options$autoRe;
|
|
43
|
-
if (!registered) {
|
|
44
|
-
table._queue(() => {
|
|
45
|
-
registered = true;
|
|
46
|
-
});
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
if ((_ref = (_table$options$autoRe = table.options.autoResetAll) != null ? _table$options$autoRe : table.options.autoResetPageIndex) != null ? _ref : !table.options.manualPagination) {
|
|
50
|
-
if (queued) return;
|
|
51
|
-
queued = true;
|
|
52
|
-
table._queue(() => {
|
|
53
|
-
table.resetPageIndex();
|
|
54
|
-
queued = false;
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
table.setPagination = updater => {
|
|
59
|
-
const safeUpdater = old => {
|
|
60
|
-
let newState = utils.functionalUpdate(updater, old);
|
|
61
|
-
return newState;
|
|
62
|
-
};
|
|
63
|
-
return table.options.onPaginationChange == null ? void 0 : table.options.onPaginationChange(safeUpdater);
|
|
64
|
-
};
|
|
65
|
-
table.resetPagination = defaultState => {
|
|
66
|
-
var _table$initialState$p;
|
|
67
|
-
table.setPagination(defaultState ? getDefaultPaginationState() : (_table$initialState$p = table.initialState.pagination) != null ? _table$initialState$p : getDefaultPaginationState());
|
|
68
|
-
};
|
|
69
|
-
table.setPageIndex = updater => {
|
|
70
|
-
table.setPagination(old => {
|
|
71
|
-
let pageIndex = utils.functionalUpdate(updater, old.pageIndex);
|
|
72
|
-
const maxPageIndex = typeof table.options.pageCount === 'undefined' || table.options.pageCount === -1 ? Number.MAX_SAFE_INTEGER : table.options.pageCount - 1;
|
|
73
|
-
pageIndex = Math.max(0, Math.min(pageIndex, maxPageIndex));
|
|
74
|
-
return {
|
|
75
|
-
...old,
|
|
76
|
-
pageIndex
|
|
77
|
-
};
|
|
78
|
-
});
|
|
79
|
-
};
|
|
80
|
-
table.resetPageIndex = defaultState => {
|
|
81
|
-
var _table$initialState$p2, _table$initialState;
|
|
82
|
-
table.setPageIndex(defaultState ? defaultPageIndex : (_table$initialState$p2 = (_table$initialState = table.initialState) == null || (_table$initialState = _table$initialState.pagination) == null ? void 0 : _table$initialState.pageIndex) != null ? _table$initialState$p2 : defaultPageIndex);
|
|
83
|
-
};
|
|
84
|
-
table.resetPageSize = defaultState => {
|
|
85
|
-
var _table$initialState$p3, _table$initialState2;
|
|
86
|
-
table.setPageSize(defaultState ? defaultPageSize : (_table$initialState$p3 = (_table$initialState2 = table.initialState) == null || (_table$initialState2 = _table$initialState2.pagination) == null ? void 0 : _table$initialState2.pageSize) != null ? _table$initialState$p3 : defaultPageSize);
|
|
87
|
-
};
|
|
88
|
-
table.setPageSize = updater => {
|
|
89
|
-
table.setPagination(old => {
|
|
90
|
-
const pageSize = Math.max(1, utils.functionalUpdate(updater, old.pageSize));
|
|
91
|
-
const topRowIndex = old.pageSize * old.pageIndex;
|
|
92
|
-
const pageIndex = Math.floor(topRowIndex / pageSize);
|
|
93
|
-
return {
|
|
94
|
-
...old,
|
|
95
|
-
pageIndex,
|
|
96
|
-
pageSize
|
|
97
|
-
};
|
|
98
|
-
});
|
|
99
|
-
};
|
|
100
|
-
//deprecated
|
|
101
|
-
table.setPageCount = updater => table.setPagination(old => {
|
|
102
|
-
var _table$options$pageCo;
|
|
103
|
-
let newPageCount = utils.functionalUpdate(updater, (_table$options$pageCo = table.options.pageCount) != null ? _table$options$pageCo : -1);
|
|
104
|
-
if (typeof newPageCount === 'number') {
|
|
105
|
-
newPageCount = Math.max(-1, newPageCount);
|
|
106
|
-
}
|
|
107
|
-
return {
|
|
108
|
-
...old,
|
|
109
|
-
pageCount: newPageCount
|
|
110
|
-
};
|
|
111
|
-
});
|
|
112
|
-
table.getPageOptions = utils.memo(() => [table.getPageCount()], pageCount => {
|
|
113
|
-
let pageOptions = [];
|
|
114
|
-
if (pageCount && pageCount > 0) {
|
|
115
|
-
pageOptions = [...new Array(pageCount)].fill(null).map((_, i) => i);
|
|
116
|
-
}
|
|
117
|
-
return pageOptions;
|
|
118
|
-
}, utils.getMemoOptions(table.options, 'debugTable', 'getPageOptions'));
|
|
119
|
-
table.getCanPreviousPage = () => table.getState().pagination.pageIndex > 0;
|
|
120
|
-
table.getCanNextPage = () => {
|
|
121
|
-
const {
|
|
122
|
-
pageIndex
|
|
123
|
-
} = table.getState().pagination;
|
|
124
|
-
const pageCount = table.getPageCount();
|
|
125
|
-
if (pageCount === -1) {
|
|
126
|
-
return true;
|
|
127
|
-
}
|
|
128
|
-
if (pageCount === 0) {
|
|
129
|
-
return false;
|
|
130
|
-
}
|
|
131
|
-
return pageIndex < pageCount - 1;
|
|
132
|
-
};
|
|
133
|
-
table.previousPage = () => {
|
|
134
|
-
return table.setPageIndex(old => old - 1);
|
|
135
|
-
};
|
|
136
|
-
table.nextPage = () => {
|
|
137
|
-
return table.setPageIndex(old => {
|
|
138
|
-
return old + 1;
|
|
139
|
-
});
|
|
140
|
-
};
|
|
141
|
-
table.firstPage = () => {
|
|
142
|
-
return table.setPageIndex(0);
|
|
143
|
-
};
|
|
144
|
-
table.lastPage = () => {
|
|
145
|
-
return table.setPageIndex(table.getPageCount() - 1);
|
|
146
|
-
};
|
|
147
|
-
table.getPrePaginationRowModel = () => table.getExpandedRowModel();
|
|
148
|
-
table.getPaginationRowModel = () => {
|
|
149
|
-
if (!table._getPaginationRowModel && table.options.getPaginationRowModel) {
|
|
150
|
-
table._getPaginationRowModel = table.options.getPaginationRowModel(table);
|
|
151
|
-
}
|
|
152
|
-
if (table.options.manualPagination || !table._getPaginationRowModel) {
|
|
153
|
-
return table.getPrePaginationRowModel();
|
|
154
|
-
}
|
|
155
|
-
return table._getPaginationRowModel();
|
|
156
|
-
};
|
|
157
|
-
table.getPageCount = () => {
|
|
158
|
-
var _table$options$pageCo2;
|
|
159
|
-
return (_table$options$pageCo2 = table.options.pageCount) != null ? _table$options$pageCo2 : Math.ceil(table.getRowCount() / table.getState().pagination.pageSize);
|
|
160
|
-
};
|
|
161
|
-
table.getRowCount = () => {
|
|
162
|
-
var _table$options$rowCou;
|
|
163
|
-
return (_table$options$rowCou = table.options.rowCount) != null ? _table$options$rowCou : table.getPrePaginationRowModel().rows.length;
|
|
164
|
-
};
|
|
165
|
-
}
|
|
166
|
-
};
|
|
167
|
-
|
|
168
|
-
exports.RowPagination = RowPagination;
|
|
169
|
-
//# sourceMappingURL=RowPagination.js.map
|