@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
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* react-table
|
|
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
|
+
*/
|
|
1
11
|
(function (global, factory) {
|
|
2
12
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react')) :
|
|
3
13
|
typeof define === 'function' && define.amd ? define(['exports', 'react'], factory) :
|
|
@@ -27,7 +37,8 @@
|
|
|
27
37
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
28
38
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
29
39
|
|
|
30
|
-
|
|
40
|
+
function columnFilterRowsFn(instance, rowModel) {
|
|
41
|
+
var columnFilters = instance.getState().columnFilters;
|
|
31
42
|
var newFilteredFlatRows = [];
|
|
32
43
|
var newFilteredRowsById = {};
|
|
33
44
|
var filterFromChildrenUp = instance.options.filterFromChildrenUp;
|
|
@@ -139,9 +150,10 @@
|
|
|
139
150
|
flatRows: newFilteredFlatRows,
|
|
140
151
|
rowsById: newFilteredRowsById
|
|
141
152
|
};
|
|
142
|
-
}
|
|
153
|
+
}
|
|
143
154
|
|
|
144
|
-
|
|
155
|
+
function globalFilterRowsFn(instance, rowModel) {
|
|
156
|
+
var globalFilter = instance.getState().globalFilter;
|
|
145
157
|
var newFilteredFlatRows = [];
|
|
146
158
|
var newFilteredRowsById = {};
|
|
147
159
|
var filterFromChildrenUp = instance.options.filterFromChildrenUp;
|
|
@@ -223,9 +235,10 @@
|
|
|
223
235
|
flatRows: newFilteredFlatRows,
|
|
224
236
|
rowsById: newFilteredRowsById
|
|
225
237
|
};
|
|
226
|
-
}
|
|
238
|
+
}
|
|
227
239
|
|
|
228
|
-
|
|
240
|
+
function sortRowsFn(instance, rowModel) {
|
|
241
|
+
var sortingState = instance.getState().sorting;
|
|
229
242
|
var sortedFlatRows = []; // Filter out sortings that correspond to non existing columns
|
|
230
243
|
|
|
231
244
|
var availableSorting = sortingState.filter(function (sort) {
|
|
@@ -300,7 +313,7 @@
|
|
|
300
313
|
flatRows: sortedFlatRows,
|
|
301
314
|
rowsById: rowModel.rowsById
|
|
302
315
|
};
|
|
303
|
-
}
|
|
316
|
+
}
|
|
304
317
|
|
|
305
318
|
function _extends() {
|
|
306
319
|
_extends = Object.assign || function (target) {
|
|
@@ -434,7 +447,7 @@
|
|
|
434
447
|
|
|
435
448
|
return _extends({}, initial, getter != null ? getter : {});
|
|
436
449
|
};
|
|
437
|
-
function memo(getDeps, fn,
|
|
450
|
+
function memo(getDeps, fn, opts) {
|
|
438
451
|
var deps = [];
|
|
439
452
|
var result;
|
|
440
453
|
return function () {
|
|
@@ -446,8 +459,8 @@
|
|
|
446
459
|
});
|
|
447
460
|
|
|
448
461
|
if (depsChanged) {
|
|
449
|
-
if (debug) {
|
|
450
|
-
console.info(key, _extends({
|
|
462
|
+
if (opts != null && opts.debug) {
|
|
463
|
+
console.info(opts == null ? void 0 : opts.key, _extends({
|
|
451
464
|
length: oldSerializedDeps.length + " -> " + newSerializedDeps.length
|
|
452
465
|
}, newSerializedDeps.map(function (_, index) {
|
|
453
466
|
if (oldSerializedDeps[index] !== newSerializedDeps[index]) {
|
|
@@ -464,8 +477,11 @@
|
|
|
464
477
|
}));
|
|
465
478
|
}
|
|
466
479
|
|
|
480
|
+
var oldResult = result;
|
|
467
481
|
result = fn.apply(void 0, newDeps);
|
|
468
482
|
deps = newSerializedDeps;
|
|
483
|
+
opts == null ? void 0 : opts.onChange == null ? void 0 : opts.onChange(result, oldResult);
|
|
484
|
+
oldResult = undefined;
|
|
469
485
|
}
|
|
470
486
|
|
|
471
487
|
return result;
|
|
@@ -506,8 +522,9 @@
|
|
|
506
522
|
// return (4294967296 * (2097151 & h2) + (h1 >>> 0)).toString()
|
|
507
523
|
// }
|
|
508
524
|
|
|
509
|
-
|
|
510
|
-
// Filter the grouping list down to columns that exist
|
|
525
|
+
function groupRowsFn(instance, sortedRowModel) {
|
|
526
|
+
var groupingState = instance.getState().grouping; // Filter the grouping list down to columns that exist
|
|
527
|
+
|
|
511
528
|
var existingGrouping = groupingState.filter(function (columnId) {
|
|
512
529
|
return instance.getColumn(columnId);
|
|
513
530
|
}); // Find the columns that can or are aggregating
|
|
@@ -624,7 +641,7 @@
|
|
|
624
641
|
flatRows: groupedFlatRows,
|
|
625
642
|
rowsById: groupedRowsById
|
|
626
643
|
};
|
|
627
|
-
}
|
|
644
|
+
}
|
|
628
645
|
|
|
629
646
|
function groupBy(rows, columnId) {
|
|
630
647
|
var groupMap = new Map();
|
|
@@ -642,7 +659,7 @@
|
|
|
642
659
|
}, groupMap);
|
|
643
660
|
}
|
|
644
661
|
|
|
645
|
-
|
|
662
|
+
function expandRowsFn(instance, sortedRowModel) {
|
|
646
663
|
var expandedRows = [];
|
|
647
664
|
var expandSubRows = instance.options.expandSubRows;
|
|
648
665
|
|
|
@@ -662,15 +679,15 @@
|
|
|
662
679
|
flatRows: sortedRowModel.flatRows,
|
|
663
680
|
rowsById: sortedRowModel.rowsById
|
|
664
681
|
};
|
|
665
|
-
}
|
|
682
|
+
}
|
|
666
683
|
|
|
667
684
|
//
|
|
668
|
-
function getInitialState$
|
|
685
|
+
function getInitialState$9() {
|
|
669
686
|
return {
|
|
670
687
|
columnVisibility: {}
|
|
671
688
|
};
|
|
672
689
|
}
|
|
673
|
-
function getDefaultOptions$
|
|
690
|
+
function getDefaultOptions$9(instance) {
|
|
674
691
|
return {
|
|
675
692
|
onColumnVisibilityChange: makeStateUpdater('columnVisibility', instance)
|
|
676
693
|
};
|
|
@@ -680,7 +697,7 @@
|
|
|
680
697
|
defaultIsVisible: true
|
|
681
698
|
};
|
|
682
699
|
}
|
|
683
|
-
function createColumn$
|
|
700
|
+
function createColumn$5(column, instance) {
|
|
684
701
|
return {
|
|
685
702
|
getCanHide: function getCanHide() {
|
|
686
703
|
return instance.getColumnCanHide(column.id);
|
|
@@ -704,7 +721,7 @@
|
|
|
704
721
|
}
|
|
705
722
|
};
|
|
706
723
|
}
|
|
707
|
-
function getInstance$
|
|
724
|
+
function getInstance$a(instance) {
|
|
708
725
|
return {
|
|
709
726
|
getVisibleFlatColumns: memo(function () {
|
|
710
727
|
return [instance.getAllFlatColumns(), instance.getAllFlatColumns().filter(function (d) {
|
|
@@ -716,7 +733,10 @@
|
|
|
716
733
|
return allFlatColumns.filter(function (d) {
|
|
717
734
|
return d.getIsVisible == null ? void 0 : d.getIsVisible();
|
|
718
735
|
});
|
|
719
|
-
},
|
|
736
|
+
}, {
|
|
737
|
+
key: 'getVisibleFlatColumns',
|
|
738
|
+
debug: instance.options.debug
|
|
739
|
+
}),
|
|
720
740
|
getVisibleLeafColumns: memo(function () {
|
|
721
741
|
return [instance.getAllLeafColumns(), instance.getAllLeafColumns().filter(function (d) {
|
|
722
742
|
return d.getIsVisible == null ? void 0 : d.getIsVisible();
|
|
@@ -727,7 +747,10 @@
|
|
|
727
747
|
return allFlatColumns.filter(function (d) {
|
|
728
748
|
return d.getIsVisible == null ? void 0 : d.getIsVisible();
|
|
729
749
|
});
|
|
730
|
-
},
|
|
750
|
+
}, {
|
|
751
|
+
key: 'getVisibleLeafColumns',
|
|
752
|
+
debug: instance.options.debug
|
|
753
|
+
}),
|
|
731
754
|
setColumnVisibility: function setColumnVisibility(updater) {
|
|
732
755
|
return instance.options.onColumnVisibilityChange == null ? void 0 : instance.options.onColumnVisibilityChange(updater, functionalUpdate(updater, instance.getState().columnVisibility));
|
|
733
756
|
},
|
|
@@ -801,6 +824,15 @@
|
|
|
801
824
|
};
|
|
802
825
|
}
|
|
803
826
|
|
|
827
|
+
var Visibility = /*#__PURE__*/Object.freeze({
|
|
828
|
+
__proto__: null,
|
|
829
|
+
getInitialState: getInitialState$9,
|
|
830
|
+
getDefaultOptions: getDefaultOptions$9,
|
|
831
|
+
getDefaultColumn: getDefaultColumn$3,
|
|
832
|
+
createColumn: createColumn$5,
|
|
833
|
+
getInstance: getInstance$a
|
|
834
|
+
});
|
|
835
|
+
|
|
804
836
|
var aggregationTypes = {
|
|
805
837
|
sum: sum,
|
|
806
838
|
min: min,
|
|
@@ -919,19 +951,19 @@
|
|
|
919
951
|
aggregationType: 'auto'
|
|
920
952
|
};
|
|
921
953
|
}
|
|
922
|
-
function getInitialState$
|
|
954
|
+
function getInitialState$8() {
|
|
923
955
|
return {
|
|
924
956
|
grouping: []
|
|
925
957
|
};
|
|
926
958
|
}
|
|
927
|
-
function getDefaultOptions$
|
|
959
|
+
function getDefaultOptions$8(instance) {
|
|
928
960
|
return {
|
|
929
961
|
onGroupingChange: makeStateUpdater('grouping', instance),
|
|
930
962
|
autoResetGrouping: true,
|
|
931
963
|
groupedColumnMode: 'reorder'
|
|
932
964
|
};
|
|
933
965
|
}
|
|
934
|
-
function createColumn$
|
|
966
|
+
function createColumn$4(column, instance) {
|
|
935
967
|
return {
|
|
936
968
|
aggregationType: column.aggregationType,
|
|
937
969
|
getCanGroup: function getCanGroup() {
|
|
@@ -951,8 +983,23 @@
|
|
|
951
983
|
}
|
|
952
984
|
};
|
|
953
985
|
}
|
|
954
|
-
function getInstance$
|
|
986
|
+
function getInstance$9(instance) {
|
|
987
|
+
var registered = false;
|
|
955
988
|
return {
|
|
989
|
+
_notifyGroupingReset: function _notifyGroupingReset() {
|
|
990
|
+
if (!registered) {
|
|
991
|
+
registered = true;
|
|
992
|
+
return;
|
|
993
|
+
}
|
|
994
|
+
|
|
995
|
+
if (instance.options.autoResetAll === false) {
|
|
996
|
+
return;
|
|
997
|
+
}
|
|
998
|
+
|
|
999
|
+
if (instance.options.autoResetAll === true || instance.options.autoResetGrouping) {
|
|
1000
|
+
instance.resetGrouping();
|
|
1001
|
+
}
|
|
1002
|
+
},
|
|
956
1003
|
getColumnAutoAggregationFn: function getColumnAutoAggregationFn(columnId) {
|
|
957
1004
|
var firstRow = instance.getCoreFlatRows()[0];
|
|
958
1005
|
var value = firstRow == null ? void 0 : firstRow.values[columnId];
|
|
@@ -1050,8 +1097,14 @@
|
|
|
1050
1097
|
}
|
|
1051
1098
|
|
|
1052
1099
|
if (instance.options.debug) console.info('Grouping...');
|
|
1053
|
-
return groupRowsFn(instance,
|
|
1054
|
-
},
|
|
1100
|
+
return groupRowsFn(instance, rowModel);
|
|
1101
|
+
}, {
|
|
1102
|
+
key: 'getGroupedRowModel',
|
|
1103
|
+
debug: instance.options.debug,
|
|
1104
|
+
onChange: function onChange() {
|
|
1105
|
+
return instance._notifyExpandedReset();
|
|
1106
|
+
}
|
|
1107
|
+
}),
|
|
1055
1108
|
getPreGroupedRows: function getPreGroupedRows() {
|
|
1056
1109
|
return instance.getSortedRowModel().rows;
|
|
1057
1110
|
},
|
|
@@ -1072,7 +1125,7 @@
|
|
|
1072
1125
|
}
|
|
1073
1126
|
};
|
|
1074
1127
|
}
|
|
1075
|
-
function createRow$
|
|
1128
|
+
function createRow$3(row, instance) {
|
|
1076
1129
|
return {
|
|
1077
1130
|
getIsGrouped: function getIsGrouped() {
|
|
1078
1131
|
return instance.getRowIsGrouped(row.id);
|
|
@@ -1115,18 +1168,30 @@
|
|
|
1115
1168
|
return [].concat(groupingColumns, nonGroupingColumns);
|
|
1116
1169
|
}
|
|
1117
1170
|
|
|
1171
|
+
var Grouping = /*#__PURE__*/Object.freeze({
|
|
1172
|
+
__proto__: null,
|
|
1173
|
+
getDefaultColumn: getDefaultColumn$2,
|
|
1174
|
+
getInitialState: getInitialState$8,
|
|
1175
|
+
getDefaultOptions: getDefaultOptions$8,
|
|
1176
|
+
createColumn: createColumn$4,
|
|
1177
|
+
getInstance: getInstance$9,
|
|
1178
|
+
createRow: createRow$3,
|
|
1179
|
+
createCell: createCell,
|
|
1180
|
+
orderColumns: orderColumns
|
|
1181
|
+
});
|
|
1182
|
+
|
|
1118
1183
|
//
|
|
1119
|
-
function getInitialState$
|
|
1184
|
+
function getInitialState$7() {
|
|
1120
1185
|
return {
|
|
1121
1186
|
columnOrder: []
|
|
1122
1187
|
};
|
|
1123
1188
|
}
|
|
1124
|
-
function getDefaultOptions$
|
|
1189
|
+
function getDefaultOptions$7(instance) {
|
|
1125
1190
|
return {
|
|
1126
1191
|
onColumnOrderChange: makeStateUpdater('columnOrder', instance)
|
|
1127
1192
|
};
|
|
1128
1193
|
}
|
|
1129
|
-
function getInstance$
|
|
1194
|
+
function getInstance$8(instance) {
|
|
1130
1195
|
return {
|
|
1131
1196
|
setColumnOrder: function setColumnOrder(updater) {
|
|
1132
1197
|
return instance.options.onColumnOrderChange == null ? void 0 : instance.options.onColumnOrderChange(updater, functionalUpdate(updater, instance.getState().columnOrder));
|
|
@@ -1173,12 +1238,22 @@
|
|
|
1173
1238
|
|
|
1174
1239
|
return orderColumns(orderedColumns, grouping, groupedColumnMode);
|
|
1175
1240
|
};
|
|
1176
|
-
},
|
|
1241
|
+
}, {
|
|
1242
|
+
key: 'getOrderColumnsFn',
|
|
1243
|
+
debug: instance.options.debug
|
|
1244
|
+
})
|
|
1177
1245
|
};
|
|
1178
1246
|
}
|
|
1179
1247
|
|
|
1248
|
+
var Ordering = /*#__PURE__*/Object.freeze({
|
|
1249
|
+
__proto__: null,
|
|
1250
|
+
getInitialState: getInitialState$7,
|
|
1251
|
+
getDefaultOptions: getDefaultOptions$7,
|
|
1252
|
+
getInstance: getInstance$8
|
|
1253
|
+
});
|
|
1254
|
+
|
|
1180
1255
|
//
|
|
1181
|
-
function getInitialState$
|
|
1256
|
+
function getInitialState$6() {
|
|
1182
1257
|
return {
|
|
1183
1258
|
columnPinning: {
|
|
1184
1259
|
left: [],
|
|
@@ -1186,12 +1261,12 @@
|
|
|
1186
1261
|
}
|
|
1187
1262
|
};
|
|
1188
1263
|
}
|
|
1189
|
-
function getDefaultOptions$
|
|
1264
|
+
function getDefaultOptions$6(instance) {
|
|
1190
1265
|
return {
|
|
1191
1266
|
onColumnPinningChange: makeStateUpdater('columnPinning', instance)
|
|
1192
1267
|
};
|
|
1193
1268
|
}
|
|
1194
|
-
function createColumn$
|
|
1269
|
+
function createColumn$3(column, instance) {
|
|
1195
1270
|
return {
|
|
1196
1271
|
getCanPin: function getCanPin() {
|
|
1197
1272
|
return instance.getColumnCanPin(column.id);
|
|
@@ -1207,7 +1282,7 @@
|
|
|
1207
1282
|
}
|
|
1208
1283
|
};
|
|
1209
1284
|
}
|
|
1210
|
-
function getInstance$
|
|
1285
|
+
function getInstance$7(instance) {
|
|
1211
1286
|
return {
|
|
1212
1287
|
setColumnPinning: function setColumnPinning(updater) {
|
|
1213
1288
|
return instance.options.onColumnPinningChange == null ? void 0 : instance.options.onColumnPinningChange(updater, functionalUpdate(updater, instance.getState().columnPinning));
|
|
@@ -1294,33 +1369,27 @@
|
|
|
1294
1369
|
var isRight = leafColumnIds.some(function (d) {
|
|
1295
1370
|
return right == null ? void 0 : right.includes(d);
|
|
1296
1371
|
});
|
|
1297
|
-
|
|
1298
|
-
if (isLeft && isRight) {
|
|
1299
|
-
return 'both';
|
|
1300
|
-
}
|
|
1301
|
-
|
|
1302
1372
|
return isLeft ? 'left' : isRight ? 'right' : false;
|
|
1303
1373
|
},
|
|
1304
1374
|
getColumnPinnedIndex: function getColumnPinnedIndex(columnId) {
|
|
1305
1375
|
var _instance$getState$co2, _instance$getState$co3, _instance$getState$co4;
|
|
1306
1376
|
|
|
1307
1377
|
var position = instance.getColumnIsPinned(columnId);
|
|
1308
|
-
|
|
1309
|
-
if (position === 'both') {
|
|
1310
|
-
{
|
|
1311
|
-
console.warn("Column " + columnId + " has leaf columns that are pinned on both sides");
|
|
1312
|
-
}
|
|
1313
|
-
|
|
1314
|
-
throw new Error();
|
|
1315
|
-
}
|
|
1316
|
-
|
|
1317
1378
|
return position ? (_instance$getState$co2 = (_instance$getState$co3 = instance.getState().columnPinning) == null ? void 0 : (_instance$getState$co4 = _instance$getState$co3[position]) == null ? void 0 : _instance$getState$co4.indexOf(columnId)) != null ? _instance$getState$co2 : -1 : 0;
|
|
1318
1379
|
}
|
|
1319
1380
|
};
|
|
1320
1381
|
}
|
|
1321
1382
|
|
|
1383
|
+
var Pinning = /*#__PURE__*/Object.freeze({
|
|
1384
|
+
__proto__: null,
|
|
1385
|
+
getInitialState: getInitialState$6,
|
|
1386
|
+
getDefaultOptions: getDefaultOptions$6,
|
|
1387
|
+
createColumn: createColumn$3,
|
|
1388
|
+
getInstance: getInstance$7
|
|
1389
|
+
});
|
|
1390
|
+
|
|
1322
1391
|
//
|
|
1323
|
-
function createRow$
|
|
1392
|
+
function createRow$2(row, instance) {
|
|
1324
1393
|
return {
|
|
1325
1394
|
_getAllVisibleCells: memo(function () {
|
|
1326
1395
|
return [row.getAllCells().filter(function (cell) {
|
|
@@ -1332,12 +1401,18 @@
|
|
|
1332
1401
|
return row.getAllCells().filter(function (cell) {
|
|
1333
1402
|
return cell.column.getIsVisible();
|
|
1334
1403
|
});
|
|
1335
|
-
},
|
|
1404
|
+
}, {
|
|
1405
|
+
key: 'row._getAllVisibleCells',
|
|
1406
|
+
debug: instance.options.debug
|
|
1407
|
+
}),
|
|
1336
1408
|
getVisibleCells: memo(function () {
|
|
1337
1409
|
return [row.getLeftVisibleCells(), row.getCenterVisibleCells(), row.getRightVisibleCells()];
|
|
1338
1410
|
}, function (left, center, right) {
|
|
1339
1411
|
return [].concat(left, center, right);
|
|
1340
|
-
},
|
|
1412
|
+
}, {
|
|
1413
|
+
key: 'row.getVisibleCells',
|
|
1414
|
+
debug: instance.options.debug
|
|
1415
|
+
}),
|
|
1341
1416
|
getCenterVisibleCells: memo(function () {
|
|
1342
1417
|
return [row._getAllVisibleCells(), instance.getState().columnPinning.left, instance.getState().columnPinning.right];
|
|
1343
1418
|
}, function (allCells, left, right) {
|
|
@@ -1345,7 +1420,10 @@
|
|
|
1345
1420
|
return allCells.filter(function (d) {
|
|
1346
1421
|
return !leftAndRight.includes(d.columnId);
|
|
1347
1422
|
});
|
|
1348
|
-
},
|
|
1423
|
+
}, {
|
|
1424
|
+
key: 'row.getCenterVisibleCells',
|
|
1425
|
+
debug: instance.options.debug
|
|
1426
|
+
}),
|
|
1349
1427
|
getLeftVisibleCells: memo(function () {
|
|
1350
1428
|
return [row._getAllVisibleCells(), instance.getState().columnPinning.left,,];
|
|
1351
1429
|
}, function (allCells, left) {
|
|
@@ -1355,7 +1433,10 @@
|
|
|
1355
1433
|
});
|
|
1356
1434
|
}).filter(Boolean);
|
|
1357
1435
|
return cells;
|
|
1358
|
-
},
|
|
1436
|
+
}, {
|
|
1437
|
+
key: 'row.getLeftVisibleCells',
|
|
1438
|
+
debug: instance.options.debug
|
|
1439
|
+
}),
|
|
1359
1440
|
getRightVisibleCells: memo(function () {
|
|
1360
1441
|
return [row._getAllVisibleCells(), instance.getState().columnPinning.right];
|
|
1361
1442
|
}, function (allCells, right) {
|
|
@@ -1365,10 +1446,13 @@
|
|
|
1365
1446
|
});
|
|
1366
1447
|
}).filter(Boolean);
|
|
1367
1448
|
return cells;
|
|
1368
|
-
},
|
|
1449
|
+
}, {
|
|
1450
|
+
key: 'row.getRightVisibleCells',
|
|
1451
|
+
debug: instance.options.debug
|
|
1452
|
+
})
|
|
1369
1453
|
};
|
|
1370
1454
|
}
|
|
1371
|
-
function getInstance$
|
|
1455
|
+
function getInstance$6(instance) {
|
|
1372
1456
|
return {
|
|
1373
1457
|
createHeader: function createHeader(column, options) {
|
|
1374
1458
|
var _options$id;
|
|
@@ -1421,17 +1505,20 @@
|
|
|
1421
1505
|
},
|
|
1422
1506
|
renderHeader: function renderHeader() {
|
|
1423
1507
|
return flexRender(column.header, {
|
|
1508
|
+
instance: instance,
|
|
1424
1509
|
header: header,
|
|
1425
1510
|
column: column
|
|
1426
1511
|
});
|
|
1427
1512
|
},
|
|
1428
1513
|
renderFooter: function renderFooter() {
|
|
1429
1514
|
return flexRender(column.footer, {
|
|
1515
|
+
instance: instance,
|
|
1430
1516
|
header: header,
|
|
1431
1517
|
column: column
|
|
1432
1518
|
});
|
|
1433
1519
|
}
|
|
1434
|
-
};
|
|
1520
|
+
}; // Yes, we have to convert instance to uknown, because we know more than the compiler here.
|
|
1521
|
+
|
|
1435
1522
|
return header;
|
|
1436
1523
|
},
|
|
1437
1524
|
// Header Groups
|
|
@@ -1449,7 +1536,10 @@
|
|
|
1449
1536
|
});
|
|
1450
1537
|
var headerGroups = buildHeaderGroups(allColumns, [].concat(leftColumns, centerColumns, rightColumns), instance);
|
|
1451
1538
|
return headerGroups;
|
|
1452
|
-
},
|
|
1539
|
+
}, {
|
|
1540
|
+
key: 'getHeaderGroups',
|
|
1541
|
+
debug: instance.options.debug
|
|
1542
|
+
}),
|
|
1453
1543
|
getCenterHeaderGroups: memo(function () {
|
|
1454
1544
|
return [instance.getAllColumns(), instance.getVisibleLeafColumns(), instance.getState().columnPinning.left, instance.getState().columnPinning.right];
|
|
1455
1545
|
}, function (allColumns, leafColumns, left, right) {
|
|
@@ -1457,7 +1547,10 @@
|
|
|
1457
1547
|
return !(left != null && left.includes(column.id)) && !(right != null && right.includes(column.id));
|
|
1458
1548
|
});
|
|
1459
1549
|
return buildHeaderGroups(allColumns, leafColumns, instance, 'center');
|
|
1460
|
-
},
|
|
1550
|
+
}, {
|
|
1551
|
+
key: 'getCenterHeaderGroups',
|
|
1552
|
+
debug: instance.options.debug
|
|
1553
|
+
}),
|
|
1461
1554
|
getLeftHeaderGroups: memo(function () {
|
|
1462
1555
|
return [instance.getAllColumns(), instance.getVisibleLeafColumns(), instance.getState().columnPinning.left];
|
|
1463
1556
|
}, function (allColumns, leafColumns, left) {
|
|
@@ -1465,7 +1558,10 @@
|
|
|
1465
1558
|
return left == null ? void 0 : left.includes(column.id);
|
|
1466
1559
|
});
|
|
1467
1560
|
return buildHeaderGroups(allColumns, leafColumns, instance, 'left');
|
|
1468
|
-
},
|
|
1561
|
+
}, {
|
|
1562
|
+
key: 'getLeftHeaderGroups',
|
|
1563
|
+
debug: instance.options.debug
|
|
1564
|
+
}),
|
|
1469
1565
|
getRightHeaderGroups: memo(function () {
|
|
1470
1566
|
return [instance.getAllColumns(), instance.getVisibleLeafColumns(), instance.getState().columnPinning.right];
|
|
1471
1567
|
}, function (allColumns, leafColumns, right) {
|
|
@@ -1473,28 +1569,43 @@
|
|
|
1473
1569
|
return right == null ? void 0 : right.includes(column.id);
|
|
1474
1570
|
});
|
|
1475
1571
|
return buildHeaderGroups(allColumns, leafColumns, instance, 'right');
|
|
1476
|
-
},
|
|
1572
|
+
}, {
|
|
1573
|
+
key: 'getRightHeaderGroups',
|
|
1574
|
+
debug: instance.options.debug
|
|
1575
|
+
}),
|
|
1477
1576
|
// Footer Groups
|
|
1478
1577
|
getFooterGroups: memo(function () {
|
|
1479
1578
|
return [instance.getHeaderGroups()];
|
|
1480
1579
|
}, function (headerGroups) {
|
|
1481
1580
|
return [].concat(headerGroups).reverse();
|
|
1482
|
-
},
|
|
1581
|
+
}, {
|
|
1582
|
+
key: 'getFooterGroups',
|
|
1583
|
+
debug: instance.options.debug
|
|
1584
|
+
}),
|
|
1483
1585
|
getLeftFooterGroups: memo(function () {
|
|
1484
1586
|
return [instance.getLeftHeaderGroups()];
|
|
1485
1587
|
}, function (headerGroups) {
|
|
1486
1588
|
return [].concat(headerGroups).reverse();
|
|
1487
|
-
},
|
|
1589
|
+
}, {
|
|
1590
|
+
key: 'getLeftFooterGroups',
|
|
1591
|
+
debug: instance.options.debug
|
|
1592
|
+
}),
|
|
1488
1593
|
getCenterFooterGroups: memo(function () {
|
|
1489
1594
|
return [instance.getCenterHeaderGroups()];
|
|
1490
1595
|
}, function (headerGroups) {
|
|
1491
1596
|
return [].concat(headerGroups).reverse();
|
|
1492
|
-
},
|
|
1597
|
+
}, {
|
|
1598
|
+
key: 'getCenterFooterGroups',
|
|
1599
|
+
debug: instance.options.debug
|
|
1600
|
+
}),
|
|
1493
1601
|
getRightFooterGroups: memo(function () {
|
|
1494
1602
|
return [instance.getRightHeaderGroups()];
|
|
1495
1603
|
}, function (headerGroups) {
|
|
1496
1604
|
return [].concat(headerGroups).reverse();
|
|
1497
|
-
},
|
|
1605
|
+
}, {
|
|
1606
|
+
key: 'getRightFooterGroups',
|
|
1607
|
+
debug: instance.options.debug
|
|
1608
|
+
}),
|
|
1498
1609
|
// Flat Headers
|
|
1499
1610
|
getFlatHeaders: memo(function () {
|
|
1500
1611
|
return [instance.getHeaderGroups()];
|
|
@@ -1502,28 +1613,40 @@
|
|
|
1502
1613
|
return headerGroups.map(function (headerGroup) {
|
|
1503
1614
|
return headerGroup.headers;
|
|
1504
1615
|
}).flat();
|
|
1505
|
-
},
|
|
1616
|
+
}, {
|
|
1617
|
+
key: 'getFlatHeaders',
|
|
1618
|
+
debug: instance.options.debug
|
|
1619
|
+
}),
|
|
1506
1620
|
getLeftFlatHeaders: memo(function () {
|
|
1507
1621
|
return [instance.getLeftHeaderGroups()];
|
|
1508
1622
|
}, function (left) {
|
|
1509
1623
|
return left.map(function (headerGroup) {
|
|
1510
1624
|
return headerGroup.headers;
|
|
1511
1625
|
}).flat();
|
|
1512
|
-
},
|
|
1626
|
+
}, {
|
|
1627
|
+
key: 'getLeftFlatHeaders',
|
|
1628
|
+
debug: instance.options.debug
|
|
1629
|
+
}),
|
|
1513
1630
|
getCenterFlatHeaders: memo(function () {
|
|
1514
1631
|
return [instance.getCenterHeaderGroups()];
|
|
1515
1632
|
}, function (left) {
|
|
1516
1633
|
return left.map(function (headerGroup) {
|
|
1517
1634
|
return headerGroup.headers;
|
|
1518
1635
|
}).flat();
|
|
1519
|
-
},
|
|
1636
|
+
}, {
|
|
1637
|
+
key: 'getCenterFlatHeaders',
|
|
1638
|
+
debug: instance.options.debug
|
|
1639
|
+
}),
|
|
1520
1640
|
getRightFlatHeaders: memo(function () {
|
|
1521
1641
|
return [instance.getRightHeaderGroups()];
|
|
1522
1642
|
}, function (left) {
|
|
1523
1643
|
return left.map(function (headerGroup) {
|
|
1524
1644
|
return headerGroup.headers;
|
|
1525
1645
|
}).flat();
|
|
1526
|
-
},
|
|
1646
|
+
}, {
|
|
1647
|
+
key: 'getRightFlatHeaders',
|
|
1648
|
+
debug: instance.options.debug
|
|
1649
|
+
}),
|
|
1527
1650
|
// Leaf Headers
|
|
1528
1651
|
getCenterLeafHeaders: memo(function () {
|
|
1529
1652
|
return [instance.getCenterFlatHeaders()];
|
|
@@ -1533,7 +1656,10 @@
|
|
|
1533
1656
|
|
|
1534
1657
|
return !((_header$subHeaders = header.subHeaders) != null && _header$subHeaders.length);
|
|
1535
1658
|
});
|
|
1536
|
-
},
|
|
1659
|
+
}, {
|
|
1660
|
+
key: 'getCenterLeafHeaders',
|
|
1661
|
+
debug: instance.options.debug
|
|
1662
|
+
}),
|
|
1537
1663
|
getLeftLeafHeaders: memo(function () {
|
|
1538
1664
|
return [instance.getLeftFlatHeaders()];
|
|
1539
1665
|
}, function (flatHeaders) {
|
|
@@ -1542,7 +1668,10 @@
|
|
|
1542
1668
|
|
|
1543
1669
|
return !((_header$subHeaders2 = header.subHeaders) != null && _header$subHeaders2.length);
|
|
1544
1670
|
});
|
|
1545
|
-
},
|
|
1671
|
+
}, {
|
|
1672
|
+
key: 'getLeftLeafHeaders',
|
|
1673
|
+
debug: instance.options.debug
|
|
1674
|
+
}),
|
|
1546
1675
|
getRightLeafHeaders: memo(function () {
|
|
1547
1676
|
return [instance.getRightFlatHeaders()];
|
|
1548
1677
|
}, function (flatHeaders) {
|
|
@@ -1551,7 +1680,10 @@
|
|
|
1551
1680
|
|
|
1552
1681
|
return !((_header$subHeaders3 = header.subHeaders) != null && _header$subHeaders3.length);
|
|
1553
1682
|
});
|
|
1554
|
-
},
|
|
1683
|
+
}, {
|
|
1684
|
+
key: 'getRightLeafHeaders',
|
|
1685
|
+
debug: instance.options.debug
|
|
1686
|
+
}),
|
|
1555
1687
|
getLeafHeaders: memo(function () {
|
|
1556
1688
|
return [instance.getLeftHeaderGroups(), instance.getCenterHeaderGroups(), instance.getRightHeaderGroups()];
|
|
1557
1689
|
}, function (left, center, right) {
|
|
@@ -1560,7 +1692,10 @@
|
|
|
1560
1692
|
return [].concat((_left$0$headers = (_left$ = left[0]) == null ? void 0 : _left$.headers) != null ? _left$0$headers : [], (_center$0$headers = (_center$ = center[0]) == null ? void 0 : _center$.headers) != null ? _center$0$headers : [], (_right$0$headers = (_right$ = right[0]) == null ? void 0 : _right$.headers) != null ? _right$0$headers : []).map(function (header) {
|
|
1561
1693
|
return header.getLeafHeaders();
|
|
1562
1694
|
}).flat();
|
|
1563
|
-
},
|
|
1695
|
+
}, {
|
|
1696
|
+
key: 'getLeafHeaders',
|
|
1697
|
+
debug: instance.options.debug
|
|
1698
|
+
}),
|
|
1564
1699
|
getHeader: function getHeader(id) {
|
|
1565
1700
|
var header = [].concat(instance.getFlatHeaders(), instance.getCenterFlatHeaders(), instance.getLeftFlatHeaders(), instance.getRightFlatHeaders()).find(function (d) {
|
|
1566
1701
|
return d.id === id;
|
|
@@ -1782,6 +1917,13 @@
|
|
|
1782
1917
|
return headerGroups;
|
|
1783
1918
|
}
|
|
1784
1919
|
|
|
1920
|
+
var Headers = /*#__PURE__*/Object.freeze({
|
|
1921
|
+
__proto__: null,
|
|
1922
|
+
createRow: createRow$2,
|
|
1923
|
+
getInstance: getInstance$6,
|
|
1924
|
+
buildHeaderGroups: buildHeaderGroups
|
|
1925
|
+
});
|
|
1926
|
+
|
|
1785
1927
|
var filterTypes = {
|
|
1786
1928
|
includesString: includesString,
|
|
1787
1929
|
includesStringSensitive: includesStringSensitive,
|
|
@@ -1944,13 +2086,13 @@
|
|
|
1944
2086
|
filterType: 'auto'
|
|
1945
2087
|
};
|
|
1946
2088
|
}
|
|
1947
|
-
function getInitialState$
|
|
2089
|
+
function getInitialState$5() {
|
|
1948
2090
|
return {
|
|
1949
2091
|
columnFilters: [],
|
|
1950
2092
|
globalFilter: undefined
|
|
1951
2093
|
};
|
|
1952
2094
|
}
|
|
1953
|
-
function getDefaultOptions$
|
|
2095
|
+
function getDefaultOptions$5(instance) {
|
|
1954
2096
|
return {
|
|
1955
2097
|
onColumnFiltersChange: makeStateUpdater('columnFilters', instance),
|
|
1956
2098
|
onGlobalFilterChange: makeStateUpdater('globalFilter', instance),
|
|
@@ -1966,7 +2108,7 @@
|
|
|
1966
2108
|
}
|
|
1967
2109
|
};
|
|
1968
2110
|
}
|
|
1969
|
-
function createColumn$
|
|
2111
|
+
function createColumn$2(column, instance) {
|
|
1970
2112
|
var getFacetInfo = memo(function () {
|
|
1971
2113
|
return [column.getPreFilteredRows()];
|
|
1972
2114
|
}, function (rows) {
|
|
@@ -2003,7 +2145,10 @@
|
|
|
2003
2145
|
preFilteredUniqueValues: preFilteredUniqueValues,
|
|
2004
2146
|
preFilteredMinMaxValues: preFilteredMinMaxValues
|
|
2005
2147
|
};
|
|
2006
|
-
},
|
|
2148
|
+
}, {
|
|
2149
|
+
key: 'column.getFacetInfo',
|
|
2150
|
+
debug: instance.options.debug
|
|
2151
|
+
});
|
|
2007
2152
|
return {
|
|
2008
2153
|
filterType: column.filterType,
|
|
2009
2154
|
getCanColumnFilter: function getCanColumnFilter() {
|
|
@@ -2035,8 +2180,31 @@
|
|
|
2035
2180
|
}
|
|
2036
2181
|
};
|
|
2037
2182
|
}
|
|
2038
|
-
function getInstance$
|
|
2183
|
+
function getInstance$5(instance) {
|
|
2184
|
+
var registered = false;
|
|
2039
2185
|
return {
|
|
2186
|
+
_notifyFiltersReset: function _notifyFiltersReset() {
|
|
2187
|
+
if (!registered) {
|
|
2188
|
+
registered = true;
|
|
2189
|
+
return;
|
|
2190
|
+
}
|
|
2191
|
+
|
|
2192
|
+
if (instance.options.autoResetAll === false) {
|
|
2193
|
+
return;
|
|
2194
|
+
}
|
|
2195
|
+
|
|
2196
|
+
if (instance.options.autoResetAll === true) {
|
|
2197
|
+
instance.resetSorting();
|
|
2198
|
+
} else {
|
|
2199
|
+
if (instance.options.autoResetColumnFilters) {
|
|
2200
|
+
instance.resetColumnFilters();
|
|
2201
|
+
}
|
|
2202
|
+
|
|
2203
|
+
if (instance.options.autoResetGlobalFilter) {
|
|
2204
|
+
instance.resetGlobalFilter();
|
|
2205
|
+
}
|
|
2206
|
+
}
|
|
2207
|
+
},
|
|
2040
2208
|
getColumnAutoFilterFn: function getColumnAutoFilterFn(columnId) {
|
|
2041
2209
|
var firstRow = instance.getCoreFlatRows()[0];
|
|
2042
2210
|
var value = firstRow == null ? void 0 : firstRow.values[columnId];
|
|
@@ -2217,7 +2385,7 @@
|
|
|
2217
2385
|
}
|
|
2218
2386
|
|
|
2219
2387
|
if (instance.options.debug) console.info('Column Filtering...');
|
|
2220
|
-
return columnFiltersFn(instance,
|
|
2388
|
+
return columnFiltersFn(instance, rowModel);
|
|
2221
2389
|
}(); // Now that each filtered column has it's partially filtered rows,
|
|
2222
2390
|
// lets assign the final filtered rows to all of the other columns
|
|
2223
2391
|
|
|
@@ -2237,7 +2405,24 @@
|
|
|
2237
2405
|
};
|
|
2238
2406
|
});
|
|
2239
2407
|
return columnFilteredRowModel;
|
|
2240
|
-
},
|
|
2408
|
+
}, {
|
|
2409
|
+
key: 'getColumnFilteredRowModel',
|
|
2410
|
+
debug: instance.options.debug
|
|
2411
|
+
}),
|
|
2412
|
+
// These might be easier to remember than "column" filtered rows
|
|
2413
|
+
getPreFilteredRowModel: function getPreFilteredRowModel() {
|
|
2414
|
+
return instance.getCoreRowModel();
|
|
2415
|
+
},
|
|
2416
|
+
getPreFilteredRows: function getPreFilteredRows() {
|
|
2417
|
+
return instance.getCoreRowModel().rows;
|
|
2418
|
+
},
|
|
2419
|
+
getPreFilteredFlatRows: function getPreFilteredFlatRows() {
|
|
2420
|
+
return instance.getCoreRowModel().flatRows;
|
|
2421
|
+
},
|
|
2422
|
+
getPreFilteredRowsById: function getPreFilteredRowsById() {
|
|
2423
|
+
return instance.getCoreRowModel().rowsById;
|
|
2424
|
+
},
|
|
2425
|
+
// Pre Column Filter
|
|
2241
2426
|
getPreColumnFilteredRows: function getPreColumnFilteredRows() {
|
|
2242
2427
|
return instance.getCoreRowModel().rows;
|
|
2243
2428
|
},
|
|
@@ -2265,7 +2450,7 @@
|
|
|
2265
2450
|
}
|
|
2266
2451
|
|
|
2267
2452
|
if (instance.options.debug) console.info('Global Filtering...');
|
|
2268
|
-
return globalFiltersFn(instance,
|
|
2453
|
+
return globalFiltersFn(instance, columnFilteredRowModel);
|
|
2269
2454
|
}(); // Now that each filtered column has it's partially filtered rows,
|
|
2270
2455
|
// lets assign the final filtered rows to all of the other columns
|
|
2271
2456
|
|
|
@@ -2285,7 +2470,13 @@
|
|
|
2285
2470
|
};
|
|
2286
2471
|
});
|
|
2287
2472
|
return globalFilteredRowModel;
|
|
2288
|
-
},
|
|
2473
|
+
}, {
|
|
2474
|
+
key: 'getGlobalFilteredRowModel',
|
|
2475
|
+
debug: instance.options.debug,
|
|
2476
|
+
onChange: function onChange() {
|
|
2477
|
+
return instance._notifySortingReset();
|
|
2478
|
+
}
|
|
2479
|
+
}),
|
|
2289
2480
|
getPreGlobalFilteredRows: function getPreGlobalFilteredRows() {
|
|
2290
2481
|
return instance.getColumnFilteredRowModel().rows;
|
|
2291
2482
|
},
|
|
@@ -2310,6 +2501,16 @@
|
|
|
2310
2501
|
return (filterFn && filterFn.autoRemove ? filterFn.autoRemove(value, column) : false) || typeof value === 'undefined' || typeof value === 'string' && !value;
|
|
2311
2502
|
}
|
|
2312
2503
|
|
|
2504
|
+
var Filters = /*#__PURE__*/Object.freeze({
|
|
2505
|
+
__proto__: null,
|
|
2506
|
+
getDefaultColumn: getDefaultColumn$1,
|
|
2507
|
+
getInitialState: getInitialState$5,
|
|
2508
|
+
getDefaultOptions: getDefaultOptions$5,
|
|
2509
|
+
createColumn: createColumn$2,
|
|
2510
|
+
getInstance: getInstance$5,
|
|
2511
|
+
shouldAutoRemoveFilter: shouldAutoRemoveFilter
|
|
2512
|
+
});
|
|
2513
|
+
|
|
2313
2514
|
var reSplitAlphaNumeric = /([0-9]+)/gm;
|
|
2314
2515
|
var sortTypes = {
|
|
2315
2516
|
alphanumeric: alphanumeric,
|
|
@@ -2421,18 +2622,21 @@
|
|
|
2421
2622
|
sortType: 'auto'
|
|
2422
2623
|
};
|
|
2423
2624
|
}
|
|
2424
|
-
function getInitialState$
|
|
2625
|
+
function getInitialState$4() {
|
|
2425
2626
|
return {
|
|
2426
2627
|
sorting: []
|
|
2427
2628
|
};
|
|
2428
2629
|
}
|
|
2429
|
-
function getDefaultOptions$
|
|
2630
|
+
function getDefaultOptions$4(instance) {
|
|
2430
2631
|
return {
|
|
2431
2632
|
onSortingChange: makeStateUpdater('sorting', instance),
|
|
2432
|
-
autoResetSorting: true
|
|
2633
|
+
autoResetSorting: true,
|
|
2634
|
+
isMultiSortEvent: function isMultiSortEvent(e) {
|
|
2635
|
+
return e.shiftKey;
|
|
2636
|
+
}
|
|
2433
2637
|
};
|
|
2434
2638
|
}
|
|
2435
|
-
function createColumn(column, instance) {
|
|
2639
|
+
function createColumn$1(column, instance) {
|
|
2436
2640
|
return {
|
|
2437
2641
|
sortType: column.sortType,
|
|
2438
2642
|
getCanSort: function getCanSort() {
|
|
@@ -2455,22 +2659,60 @@
|
|
|
2455
2659
|
}
|
|
2456
2660
|
};
|
|
2457
2661
|
}
|
|
2458
|
-
function getInstance$
|
|
2662
|
+
function getInstance$4(instance) {
|
|
2663
|
+
var registered = false;
|
|
2459
2664
|
return {
|
|
2665
|
+
_notifySortingReset: function _notifySortingReset() {
|
|
2666
|
+
if (!registered) {
|
|
2667
|
+
registered = true;
|
|
2668
|
+
return;
|
|
2669
|
+
}
|
|
2670
|
+
|
|
2671
|
+
if (instance.options.autoResetAll === false) {
|
|
2672
|
+
return;
|
|
2673
|
+
}
|
|
2674
|
+
|
|
2675
|
+
if (instance.options.autoResetAll === true || instance.options.autoResetSorting) {
|
|
2676
|
+
instance.resetSorting();
|
|
2677
|
+
}
|
|
2678
|
+
},
|
|
2460
2679
|
getColumnAutoSortingFn: function getColumnAutoSortingFn(columnId) {
|
|
2461
|
-
var
|
|
2462
|
-
var
|
|
2680
|
+
var firstRows = instance.getGlobalFilteredRowModel().flatRows.slice(100);
|
|
2681
|
+
var isString = false;
|
|
2463
2682
|
|
|
2464
|
-
|
|
2465
|
-
|
|
2683
|
+
for (var _iterator = _createForOfIteratorHelperLoose(firstRows), _step; !(_step = _iterator()).done;) {
|
|
2684
|
+
var row = _step.value;
|
|
2685
|
+
var value = row == null ? void 0 : row.values[columnId];
|
|
2686
|
+
|
|
2687
|
+
if (Object.prototype.toString.call(value) === '[object Date]') {
|
|
2688
|
+
return sortTypes.datetime;
|
|
2689
|
+
}
|
|
2690
|
+
|
|
2691
|
+
if (typeof value === 'string') {
|
|
2692
|
+
isString = true;
|
|
2693
|
+
|
|
2694
|
+
if (value.split(reSplitAlphaNumeric).length > 1) {
|
|
2695
|
+
return sortTypes.alphanumeric;
|
|
2696
|
+
}
|
|
2697
|
+
}
|
|
2466
2698
|
}
|
|
2467
2699
|
|
|
2468
|
-
if (
|
|
2469
|
-
return sortTypes.
|
|
2700
|
+
if (isString) {
|
|
2701
|
+
return sortTypes.text;
|
|
2470
2702
|
}
|
|
2471
2703
|
|
|
2472
2704
|
return sortTypes.basic;
|
|
2473
2705
|
},
|
|
2706
|
+
getColumnAutoSortDir: function getColumnAutoSortDir(columnId) {
|
|
2707
|
+
var firstRow = instance.getGlobalFilteredRowModel().flatRows[0];
|
|
2708
|
+
var value = firstRow == null ? void 0 : firstRow.values[columnId];
|
|
2709
|
+
|
|
2710
|
+
if (typeof value === 'string') {
|
|
2711
|
+
return 'asc';
|
|
2712
|
+
}
|
|
2713
|
+
|
|
2714
|
+
return 'desc';
|
|
2715
|
+
},
|
|
2474
2716
|
getColumnSortingFn: function getColumnSortingFn(columnId) {
|
|
2475
2717
|
var _ref;
|
|
2476
2718
|
|
|
@@ -2481,7 +2723,7 @@
|
|
|
2481
2723
|
throw new Error();
|
|
2482
2724
|
}
|
|
2483
2725
|
|
|
2484
|
-
return isFunction(column.sortType) ? column.sortType : column.sortType === 'auto' ? instance.
|
|
2726
|
+
return isFunction(column.sortType) ? column.sortType : column.sortType === 'auto' ? instance.getColumnAutoSortingFn(columnId) : (_ref = userSortTypes == null ? void 0 : userSortTypes[column.sortType]) != null ? _ref : sortTypes[column.sortType];
|
|
2485
2727
|
},
|
|
2486
2728
|
setSorting: function setSorting(updater) {
|
|
2487
2729
|
return instance.options.onSortingChange == null ? void 0 : instance.options.onSortingChange(updater, functionalUpdate(updater, instance.getState().sorting));
|
|
@@ -2491,10 +2733,18 @@
|
|
|
2491
2733
|
|
|
2492
2734
|
if (!column) {
|
|
2493
2735
|
throw new Error();
|
|
2494
|
-
}
|
|
2736
|
+
} // if (column.columns.length) {
|
|
2737
|
+
// column.columns.forEach((c, i) => {
|
|
2738
|
+
// if (c.id) {
|
|
2739
|
+
// instance.toggleColumnSorting(c.id, undefined, multi || !!i)
|
|
2740
|
+
// }
|
|
2741
|
+
// })
|
|
2742
|
+
// return
|
|
2743
|
+
// }
|
|
2744
|
+
|
|
2495
2745
|
|
|
2496
2746
|
instance.setSorting(function (old) {
|
|
2497
|
-
var _column$sortDescFirst, _instance$options$ena, _instance$options$ena2;
|
|
2747
|
+
var _ref2, _column$sortDescFirst, _instance$options$ena, _instance$options$ena2;
|
|
2498
2748
|
|
|
2499
2749
|
// Find any existing sorting for this column
|
|
2500
2750
|
var existingSorting = old == null ? void 0 : old.find(function (d) {
|
|
@@ -2508,7 +2758,7 @@
|
|
|
2508
2758
|
|
|
2509
2759
|
var sortAction;
|
|
2510
2760
|
|
|
2511
|
-
if (
|
|
2761
|
+
if (column.getCanMultiSort() && multi) {
|
|
2512
2762
|
if (existingSorting) {
|
|
2513
2763
|
sortAction = 'toggle';
|
|
2514
2764
|
} else {
|
|
@@ -2525,7 +2775,7 @@
|
|
|
2525
2775
|
}
|
|
2526
2776
|
}
|
|
2527
2777
|
|
|
2528
|
-
var sortDescFirst = (_column$sortDescFirst = column.sortDescFirst) != null ? _column$sortDescFirst : instance.options.sortDescFirst; // Handle toggle states that will remove the sorting
|
|
2778
|
+
var sortDescFirst = (_ref2 = (_column$sortDescFirst = column.sortDescFirst) != null ? _column$sortDescFirst : instance.options.sortDescFirst) != null ? _ref2 : instance.getColumnAutoSortDir(columnId) === 'desc'; // Handle toggle states that will remove the sorting
|
|
2529
2779
|
|
|
2530
2780
|
if (sortAction === 'toggle' && ( // Must be toggling
|
|
2531
2781
|
(_instance$options$ena = instance.options.enableSortingRemoval) != null ? _instance$options$ena : true) && // If enableSortRemove, enable in general
|
|
@@ -2571,7 +2821,7 @@
|
|
|
2571
2821
|
});
|
|
2572
2822
|
},
|
|
2573
2823
|
getColumnCanSort: function getColumnCanSort(columnId) {
|
|
2574
|
-
var
|
|
2824
|
+
var _ref3, _ref4, _column$enableSorting;
|
|
2575
2825
|
|
|
2576
2826
|
var column = instance.getColumn(columnId);
|
|
2577
2827
|
|
|
@@ -2579,10 +2829,13 @@
|
|
|
2579
2829
|
throw new Error();
|
|
2580
2830
|
}
|
|
2581
2831
|
|
|
2582
|
-
return (
|
|
2832
|
+
return (_ref3 = (_ref4 = (_column$enableSorting = column.enableSorting) != null ? _column$enableSorting : instance.options.enableSorting) != null ? _ref4 : column.defaultCanSort) != null ? _ref3 : !!column.accessorFn // (!!column.accessorFn ||
|
|
2833
|
+
// column.columns?.some(c => c.id && instance.getColumnCanSort(c.id))) ??
|
|
2834
|
+
// false
|
|
2835
|
+
;
|
|
2583
2836
|
},
|
|
2584
2837
|
getColumnCanMultiSort: function getColumnCanMultiSort(columnId) {
|
|
2585
|
-
var
|
|
2838
|
+
var _ref5, _column$enableMultiSo;
|
|
2586
2839
|
|
|
2587
2840
|
var column = instance.getColumn(columnId);
|
|
2588
2841
|
|
|
@@ -2590,7 +2843,7 @@
|
|
|
2590
2843
|
throw new Error();
|
|
2591
2844
|
}
|
|
2592
2845
|
|
|
2593
|
-
return (
|
|
2846
|
+
return (_ref5 = (_column$enableMultiSo = column.enableMultiSort) != null ? _column$enableMultiSo : instance.options.enableMultiSort) != null ? _ref5 : !!column.accessorFn;
|
|
2594
2847
|
},
|
|
2595
2848
|
getColumnIsSorted: function getColumnIsSorted(columnId) {
|
|
2596
2849
|
var _instance$getState$so;
|
|
@@ -2637,8 +2890,14 @@
|
|
|
2637
2890
|
}
|
|
2638
2891
|
|
|
2639
2892
|
if (instance.options.debug) console.info('Sorting...');
|
|
2640
|
-
return sortingFn(instance,
|
|
2641
|
-
},
|
|
2893
|
+
return sortingFn(instance, rowModel);
|
|
2894
|
+
}, {
|
|
2895
|
+
key: 'getSortedRowModel',
|
|
2896
|
+
debug: instance.options.debug,
|
|
2897
|
+
onChange: function onChange() {
|
|
2898
|
+
return instance._notifyGroupingReset();
|
|
2899
|
+
}
|
|
2900
|
+
}),
|
|
2642
2901
|
getPreSortedRows: function getPreSortedRows() {
|
|
2643
2902
|
return instance.getGlobalFilteredRowModel().rows;
|
|
2644
2903
|
},
|
|
@@ -2660,13 +2919,22 @@
|
|
|
2660
2919
|
};
|
|
2661
2920
|
}
|
|
2662
2921
|
|
|
2922
|
+
var Sorting = /*#__PURE__*/Object.freeze({
|
|
2923
|
+
__proto__: null,
|
|
2924
|
+
getDefaultColumn: getDefaultColumn,
|
|
2925
|
+
getInitialState: getInitialState$4,
|
|
2926
|
+
getDefaultOptions: getDefaultOptions$4,
|
|
2927
|
+
createColumn: createColumn$1,
|
|
2928
|
+
getInstance: getInstance$4
|
|
2929
|
+
});
|
|
2930
|
+
|
|
2663
2931
|
//
|
|
2664
|
-
function getInitialState() {
|
|
2932
|
+
function getInitialState$3() {
|
|
2665
2933
|
return {
|
|
2666
2934
|
expanded: {}
|
|
2667
2935
|
};
|
|
2668
2936
|
}
|
|
2669
|
-
function getDefaultOptions(instance) {
|
|
2937
|
+
function getDefaultOptions$3(instance) {
|
|
2670
2938
|
return {
|
|
2671
2939
|
onExpandedChange: makeStateUpdater('expanded', instance),
|
|
2672
2940
|
autoResetExpanded: true,
|
|
@@ -2677,8 +2945,23 @@
|
|
|
2677
2945
|
paginateExpandedRows: true
|
|
2678
2946
|
};
|
|
2679
2947
|
}
|
|
2680
|
-
function getInstance(instance) {
|
|
2948
|
+
function getInstance$3(instance) {
|
|
2949
|
+
var registered = false;
|
|
2681
2950
|
return {
|
|
2951
|
+
_notifyExpandedReset: function _notifyExpandedReset() {
|
|
2952
|
+
if (!registered) {
|
|
2953
|
+
registered = true;
|
|
2954
|
+
return;
|
|
2955
|
+
}
|
|
2956
|
+
|
|
2957
|
+
if (instance.options.autoResetAll === false) {
|
|
2958
|
+
return;
|
|
2959
|
+
}
|
|
2960
|
+
|
|
2961
|
+
if (instance.options.autoResetAll === true || instance.options.autoResetExpanded) {
|
|
2962
|
+
instance.resetExpanded();
|
|
2963
|
+
}
|
|
2964
|
+
},
|
|
2682
2965
|
setExpanded: function setExpanded(updater) {
|
|
2683
2966
|
return instance.options.onExpandedChange == null ? void 0 : instance.options.onExpandedChange(updater, functionalUpdate(updater, instance.getState().expanded));
|
|
2684
2967
|
},
|
|
@@ -2826,8 +3109,14 @@
|
|
|
2826
3109
|
}
|
|
2827
3110
|
|
|
2828
3111
|
if (instance.options.debug) console.info('Expanding...');
|
|
2829
|
-
return expandRowsFn(instance,
|
|
2830
|
-
},
|
|
3112
|
+
return expandRowsFn(instance, rowModel);
|
|
3113
|
+
}, {
|
|
3114
|
+
key: 'getExpandedRowModel',
|
|
3115
|
+
debug: instance.options.debug,
|
|
3116
|
+
onChange: function onChange() {
|
|
3117
|
+
return instance._notifyPageIndexReset();
|
|
3118
|
+
}
|
|
3119
|
+
}),
|
|
2831
3120
|
getPreExpandedRows: function getPreExpandedRows() {
|
|
2832
3121
|
return instance.getGroupedRowModel().rows;
|
|
2833
3122
|
},
|
|
@@ -2848,7 +3137,7 @@
|
|
|
2848
3137
|
}
|
|
2849
3138
|
};
|
|
2850
3139
|
}
|
|
2851
|
-
function createRow(row, instance) {
|
|
3140
|
+
function createRow$1(row, instance) {
|
|
2852
3141
|
return {
|
|
2853
3142
|
toggleExpanded: function toggleExpanded(expanded) {
|
|
2854
3143
|
return void instance.toggleRowExpanded(row.id, expanded);
|
|
@@ -2872,112 +3161,1139 @@
|
|
|
2872
3161
|
};
|
|
2873
3162
|
}
|
|
2874
3163
|
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
var instance = {};
|
|
2883
|
-
|
|
2884
|
-
var defaultOptions = _extends({}, getDefaultOptions$6(instance), getDefaultOptions$4(instance), getDefaultOptions$3(instance), getDefaultOptions$2(instance), getDefaultOptions$1(instance), getDefaultOptions$5(instance), getDefaultOptions(instance));
|
|
2885
|
-
|
|
2886
|
-
var defaultState = {};
|
|
3164
|
+
var Expanding = /*#__PURE__*/Object.freeze({
|
|
3165
|
+
__proto__: null,
|
|
3166
|
+
getInitialState: getInitialState$3,
|
|
3167
|
+
getDefaultOptions: getDefaultOptions$3,
|
|
3168
|
+
getInstance: getInstance$3,
|
|
3169
|
+
createRow: createRow$1
|
|
3170
|
+
});
|
|
2887
3171
|
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
3172
|
+
//
|
|
3173
|
+
var defaultColumnSizing = {
|
|
3174
|
+
width: 150,
|
|
3175
|
+
minWidth: 20,
|
|
3176
|
+
maxWidth: Number.MAX_SAFE_INTEGER
|
|
3177
|
+
};
|
|
3178
|
+
function getInitialState$2() {
|
|
3179
|
+
return {
|
|
3180
|
+
columnSizing: {},
|
|
3181
|
+
columnSizingInfo: {
|
|
3182
|
+
startOffset: null,
|
|
3183
|
+
startSize: null,
|
|
3184
|
+
deltaOffset: null,
|
|
3185
|
+
deltaPercentage: null,
|
|
3186
|
+
isResizingColumn: false,
|
|
3187
|
+
columnSizingStart: []
|
|
3188
|
+
}
|
|
2892
3189
|
};
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
3190
|
+
}
|
|
3191
|
+
function getDefaultOptions$2(instance) {
|
|
3192
|
+
return {
|
|
3193
|
+
columnResizeMode: 'onEnd',
|
|
3194
|
+
onColumnSizingChange: makeStateUpdater('columnSizing', instance),
|
|
3195
|
+
onColumnSizingInfoChange: makeStateUpdater('columnSizingInfo', instance)
|
|
3196
|
+
};
|
|
3197
|
+
}
|
|
3198
|
+
function getInstance$2(instance) {
|
|
3199
|
+
return {
|
|
3200
|
+
setColumnSizing: function setColumnSizing(updater) {
|
|
3201
|
+
return instance.options.onColumnSizingChange == null ? void 0 : instance.options.onColumnSizingChange(updater, functionalUpdate(updater, instance.getState().columnSizing));
|
|
2904
3202
|
},
|
|
2905
|
-
|
|
2906
|
-
instance.options
|
|
3203
|
+
setColumnSizingInfo: function setColumnSizingInfo(updater) {
|
|
3204
|
+
return instance.options.onColumnSizingInfoChange == null ? void 0 : instance.options.onColumnSizingInfoChange(updater, functionalUpdate(updater, instance.getState().columnSizingInfo));
|
|
2907
3205
|
},
|
|
2908
|
-
|
|
2909
|
-
|
|
3206
|
+
resetColumnSizing: function resetColumnSizing() {
|
|
3207
|
+
var _instance$initialStat;
|
|
3208
|
+
|
|
3209
|
+
instance.setColumnSizing((_instance$initialStat = instance.initialState.columnSizing) != null ? _instance$initialStat : {});
|
|
2910
3210
|
},
|
|
2911
|
-
|
|
2912
|
-
|
|
3211
|
+
resetHeaderSizeInfo: function resetHeaderSizeInfo() {
|
|
3212
|
+
var _instance$initialStat2;
|
|
3213
|
+
|
|
3214
|
+
instance.setColumnSizingInfo((_instance$initialStat2 = instance.initialState.columnSizingInfo) != null ? _instance$initialStat2 : {});
|
|
2913
3215
|
},
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
3216
|
+
resetColumnSize: function resetColumnSize(columnId) {
|
|
3217
|
+
instance.setColumnSizing(function (_ref) {
|
|
3218
|
+
_ref[columnId];
|
|
3219
|
+
var rest = _objectWithoutPropertiesLoose(_ref, [columnId].map(_toPropertyKey));
|
|
2918
3220
|
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
3221
|
+
return rest;
|
|
3222
|
+
});
|
|
3223
|
+
},
|
|
3224
|
+
resetHeaderSize: function resetHeaderSize(headerId) {
|
|
3225
|
+
var header = instance.getHeader(headerId);
|
|
2922
3226
|
|
|
2923
|
-
if (
|
|
2924
|
-
onStateChange(newState);
|
|
3227
|
+
if (!header) {
|
|
2925
3228
|
return;
|
|
2926
3229
|
}
|
|
2927
3230
|
|
|
2928
|
-
|
|
2929
|
-
instance.rerender();
|
|
2930
|
-
}
|
|
3231
|
+
return instance.resetColumnSize(header.column.id);
|
|
2931
3232
|
},
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
}, function (defaultColumn) {
|
|
2935
|
-
var _defaultColumn;
|
|
3233
|
+
getHeaderCanResize: function getHeaderCanResize(headerId) {
|
|
3234
|
+
var header = instance.getHeader(headerId);
|
|
2936
3235
|
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
footer: function footer(props) {
|
|
2943
|
-
return props.header.column.id;
|
|
2944
|
-
},
|
|
2945
|
-
cell: function cell(_ref) {
|
|
2946
|
-
var _ref$value = _ref.value,
|
|
2947
|
-
value = _ref$value === void 0 ? '' : _ref$value;
|
|
2948
|
-
return typeof value === 'boolean' ? value.toString() : value;
|
|
2949
|
-
}
|
|
2950
|
-
}, getDefaultColumn$3(), getDefaultColumn$1(), getDefaultColumn(), getDefaultColumn$2(), defaultColumn);
|
|
2951
|
-
}, 'getDefaultColumn', instance.options.debug),
|
|
2952
|
-
getColumnDefs: function getColumnDefs() {
|
|
2953
|
-
return instance.options.columns;
|
|
3236
|
+
if (!header) {
|
|
3237
|
+
throw new Error();
|
|
3238
|
+
}
|
|
3239
|
+
|
|
3240
|
+
return instance.getColumnCanResize(header.column.id);
|
|
2954
3241
|
},
|
|
2955
|
-
|
|
2956
|
-
var _ref2,
|
|
3242
|
+
getColumnCanResize: function getColumnCanResize(columnId) {
|
|
3243
|
+
var _ref2, _ref3, _column$enableResizin;
|
|
2957
3244
|
|
|
2958
|
-
var
|
|
2959
|
-
var id = (_ref2 = (_columnDef$id = columnDef.id) != null ? _columnDef$id : columnDef.accessorKey) != null ? _ref2 : typeof columnDef.header === 'string' ? columnDef.header : undefined;
|
|
2960
|
-
var accessorFn;
|
|
3245
|
+
var column = instance.getColumn(columnId);
|
|
2961
3246
|
|
|
2962
|
-
if (
|
|
2963
|
-
|
|
2964
|
-
} else if (columnDef.accessorKey) {
|
|
2965
|
-
accessorFn = function accessorFn(originalRow) {
|
|
2966
|
-
return originalRow[columnDef.accessorKey];
|
|
2967
|
-
};
|
|
3247
|
+
if (!column) {
|
|
3248
|
+
throw new Error();
|
|
2968
3249
|
}
|
|
2969
3250
|
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
3251
|
+
return (_ref2 = (_ref3 = (_column$enableResizin = column.enableResizing) != null ? _column$enableResizin : instance.options.enableColumnResizing) != null ? _ref3 : column.defaultCanResize) != null ? _ref2 : true;
|
|
3252
|
+
},
|
|
3253
|
+
getColumnIsResizing: function getColumnIsResizing(columnId) {
|
|
3254
|
+
var column = instance.getColumn(columnId);
|
|
3255
|
+
|
|
3256
|
+
if (!column) {
|
|
3257
|
+
throw new Error();
|
|
2974
3258
|
}
|
|
2975
3259
|
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
3260
|
+
return instance.getState().columnSizingInfo.isResizingColumn === columnId;
|
|
3261
|
+
},
|
|
3262
|
+
getHeaderIsResizing: function getHeaderIsResizing(headerId) {
|
|
3263
|
+
var header = instance.getHeader(headerId);
|
|
3264
|
+
|
|
3265
|
+
if (!header) {
|
|
3266
|
+
throw new Error();
|
|
3267
|
+
}
|
|
3268
|
+
|
|
3269
|
+
return instance.getColumnIsResizing(header.column.id);
|
|
3270
|
+
},
|
|
3271
|
+
getColumnResizerProps: function getColumnResizerProps(headerId, userProps) {
|
|
3272
|
+
var header = instance.getHeader(headerId);
|
|
3273
|
+
|
|
3274
|
+
if (!header) {
|
|
3275
|
+
return;
|
|
3276
|
+
}
|
|
3277
|
+
|
|
3278
|
+
var column = instance.getColumn(header.column.id);
|
|
3279
|
+
|
|
3280
|
+
if (!column) {
|
|
3281
|
+
return;
|
|
3282
|
+
}
|
|
3283
|
+
|
|
3284
|
+
var canResize = column.getCanResize();
|
|
3285
|
+
|
|
3286
|
+
var onResizeStart = function onResizeStart(e) {
|
|
3287
|
+
if (isTouchStartEvent(e)) {
|
|
3288
|
+
// lets not respond to multiple touches (e.g. 2 or 3 fingers)
|
|
3289
|
+
if (e.touches && e.touches.length > 1) {
|
|
3290
|
+
return;
|
|
3291
|
+
}
|
|
3292
|
+
}
|
|
3293
|
+
|
|
3294
|
+
var columnSizingStart = header.getLeafHeaders().map(function (d) {
|
|
3295
|
+
return [d.column.id, d.getWidth()];
|
|
3296
|
+
});
|
|
3297
|
+
var clientX = isTouchStartEvent(e) ? Math.round(e.touches[0].clientX) : e.clientX;
|
|
3298
|
+
|
|
3299
|
+
var updateOffset = function updateOffset(eventType, clientXPos) {
|
|
3300
|
+
if (typeof clientXPos !== 'number') {
|
|
3301
|
+
return;
|
|
3302
|
+
}
|
|
3303
|
+
|
|
3304
|
+
var newColumnSizing = {};
|
|
3305
|
+
instance.setColumnSizingInfo(function (old) {
|
|
3306
|
+
var _old$startOffset, _old$startSize;
|
|
3307
|
+
|
|
3308
|
+
var deltaOffset = clientXPos - ((_old$startOffset = old == null ? void 0 : old.startOffset) != null ? _old$startOffset : 0);
|
|
3309
|
+
var deltaPercentage = Math.max(deltaOffset / ((_old$startSize = old == null ? void 0 : old.startSize) != null ? _old$startSize : 0), -0.999999);
|
|
3310
|
+
old.columnSizingStart.forEach(function (_ref4) {
|
|
3311
|
+
var columnId = _ref4[0],
|
|
3312
|
+
headerWidth = _ref4[1];
|
|
3313
|
+
newColumnSizing[columnId] = Math.max(headerWidth + headerWidth * deltaPercentage, 0);
|
|
3314
|
+
});
|
|
3315
|
+
return _extends({}, old, {
|
|
3316
|
+
deltaOffset: deltaOffset,
|
|
3317
|
+
deltaPercentage: deltaPercentage
|
|
3318
|
+
});
|
|
3319
|
+
});
|
|
3320
|
+
|
|
3321
|
+
if (instance.options.columnResizeMode === 'onChange' || eventType === 'end') {
|
|
3322
|
+
instance.setColumnSizing(function (old) {
|
|
3323
|
+
return _extends({}, old, newColumnSizing);
|
|
3324
|
+
});
|
|
3325
|
+
}
|
|
3326
|
+
};
|
|
3327
|
+
|
|
3328
|
+
var onMove = function onMove(clientXPos) {
|
|
3329
|
+
return updateOffset('move', clientXPos);
|
|
3330
|
+
};
|
|
3331
|
+
|
|
3332
|
+
var onEnd = function onEnd(clientXPos) {
|
|
3333
|
+
updateOffset('end', clientXPos);
|
|
3334
|
+
instance.setColumnSizingInfo(function (old) {
|
|
3335
|
+
return _extends({}, old, {
|
|
3336
|
+
isResizingColumn: false,
|
|
3337
|
+
startOffset: null,
|
|
3338
|
+
startSize: null,
|
|
3339
|
+
deltaOffset: null,
|
|
3340
|
+
deltaPercentage: null,
|
|
3341
|
+
columnSizingStart: []
|
|
3342
|
+
});
|
|
3343
|
+
});
|
|
3344
|
+
};
|
|
3345
|
+
|
|
3346
|
+
var mouseEvents = {
|
|
3347
|
+
moveHandler: function moveHandler(e) {
|
|
3348
|
+
return onMove(e.clientX);
|
|
3349
|
+
},
|
|
3350
|
+
upHandler: function upHandler(e) {
|
|
3351
|
+
document.removeEventListener('mousemove', mouseEvents.moveHandler);
|
|
3352
|
+
document.removeEventListener('mouseup', mouseEvents.upHandler);
|
|
3353
|
+
onEnd(e.clientX);
|
|
3354
|
+
}
|
|
3355
|
+
};
|
|
3356
|
+
var touchEvents = {
|
|
3357
|
+
moveHandler: function moveHandler(e) {
|
|
3358
|
+
if (e.cancelable) {
|
|
3359
|
+
e.preventDefault();
|
|
3360
|
+
e.stopPropagation();
|
|
3361
|
+
}
|
|
3362
|
+
|
|
3363
|
+
onMove(e.touches[0].clientX);
|
|
3364
|
+
return false;
|
|
3365
|
+
},
|
|
3366
|
+
upHandler: function upHandler(e) {
|
|
3367
|
+
document.removeEventListener('touchmove', touchEvents.moveHandler);
|
|
3368
|
+
document.removeEventListener('touchend', touchEvents.upHandler);
|
|
3369
|
+
|
|
3370
|
+
if (e.cancelable) {
|
|
3371
|
+
e.preventDefault();
|
|
3372
|
+
e.stopPropagation();
|
|
3373
|
+
}
|
|
3374
|
+
|
|
3375
|
+
onEnd(e.touches[0].clientX);
|
|
3376
|
+
}
|
|
3377
|
+
};
|
|
3378
|
+
var passiveIfSupported = passiveEventSupported() ? {
|
|
3379
|
+
passive: false
|
|
3380
|
+
} : false;
|
|
3381
|
+
|
|
3382
|
+
if (isTouchStartEvent(e)) {
|
|
3383
|
+
document.addEventListener('touchmove', touchEvents.moveHandler, passiveIfSupported);
|
|
3384
|
+
document.addEventListener('touchend', touchEvents.upHandler, passiveIfSupported);
|
|
3385
|
+
} else {
|
|
3386
|
+
document.addEventListener('mousemove', mouseEvents.moveHandler, passiveIfSupported);
|
|
3387
|
+
document.addEventListener('mouseup', mouseEvents.upHandler, passiveIfSupported);
|
|
3388
|
+
}
|
|
3389
|
+
|
|
3390
|
+
instance.setColumnSizingInfo(function (old) {
|
|
3391
|
+
return _extends({}, old, {
|
|
3392
|
+
startOffset: clientX,
|
|
3393
|
+
startSize: header.getWidth(),
|
|
3394
|
+
deltaOffset: 0,
|
|
3395
|
+
deltaPercentage: 0,
|
|
3396
|
+
columnSizingStart: columnSizingStart,
|
|
3397
|
+
isResizingColumn: header.column.id
|
|
3398
|
+
});
|
|
3399
|
+
});
|
|
3400
|
+
};
|
|
3401
|
+
|
|
3402
|
+
var initialProps = canResize ? {
|
|
3403
|
+
title: 'Toggle Grouping',
|
|
3404
|
+
draggable: false,
|
|
3405
|
+
role: 'separator',
|
|
3406
|
+
onMouseDown: function onMouseDown(e) {
|
|
3407
|
+
e.persist();
|
|
3408
|
+
onResizeStart(e);
|
|
3409
|
+
},
|
|
3410
|
+
onTouchStart: function onTouchStart(e) {
|
|
3411
|
+
e.persist();
|
|
3412
|
+
onResizeStart(e);
|
|
3413
|
+
}
|
|
3414
|
+
} : {};
|
|
3415
|
+
return propGetter(initialProps, userProps);
|
|
3416
|
+
}
|
|
3417
|
+
};
|
|
3418
|
+
}
|
|
3419
|
+
function createColumn(column, instance) {
|
|
3420
|
+
return {
|
|
3421
|
+
getIsResizing: function getIsResizing() {
|
|
3422
|
+
return instance.getColumnIsResizing(column.id);
|
|
3423
|
+
},
|
|
3424
|
+
getCanResize: function getCanResize() {
|
|
3425
|
+
return instance.getColumnCanResize(column.id);
|
|
3426
|
+
},
|
|
3427
|
+
resetSize: function resetSize() {
|
|
3428
|
+
return instance.resetColumnSize(column.id);
|
|
3429
|
+
},
|
|
3430
|
+
getResizerProps: function getResizerProps(userProps) {
|
|
3431
|
+
return instance.getColumnResizerProps(column.id, userProps);
|
|
3432
|
+
}
|
|
3433
|
+
};
|
|
3434
|
+
}
|
|
3435
|
+
var passiveSupported = null;
|
|
3436
|
+
function passiveEventSupported() {
|
|
3437
|
+
if (typeof passiveSupported === 'boolean') return passiveSupported;
|
|
3438
|
+
var supported = false;
|
|
3439
|
+
|
|
3440
|
+
try {
|
|
3441
|
+
var options = {
|
|
3442
|
+
get passive() {
|
|
3443
|
+
supported = true;
|
|
3444
|
+
return false;
|
|
3445
|
+
}
|
|
3446
|
+
|
|
3447
|
+
};
|
|
3448
|
+
|
|
3449
|
+
var noop = function noop() {};
|
|
3450
|
+
|
|
3451
|
+
window.addEventListener('test', noop, options);
|
|
3452
|
+
window.removeEventListener('test', noop);
|
|
3453
|
+
} catch (err) {
|
|
3454
|
+
supported = false;
|
|
3455
|
+
}
|
|
3456
|
+
|
|
3457
|
+
passiveSupported = supported;
|
|
3458
|
+
return passiveSupported;
|
|
3459
|
+
}
|
|
3460
|
+
|
|
3461
|
+
function isTouchStartEvent(e) {
|
|
3462
|
+
return e.type === 'touchstart';
|
|
3463
|
+
}
|
|
3464
|
+
|
|
3465
|
+
var ColumnSizing = /*#__PURE__*/Object.freeze({
|
|
3466
|
+
__proto__: null,
|
|
3467
|
+
defaultColumnSizing: defaultColumnSizing,
|
|
3468
|
+
getInitialState: getInitialState$2,
|
|
3469
|
+
getDefaultOptions: getDefaultOptions$2,
|
|
3470
|
+
getInstance: getInstance$2,
|
|
3471
|
+
createColumn: createColumn,
|
|
3472
|
+
passiveEventSupported: passiveEventSupported
|
|
3473
|
+
});
|
|
3474
|
+
|
|
3475
|
+
//
|
|
3476
|
+
function getInitialState$1() {
|
|
3477
|
+
return {
|
|
3478
|
+
pagination: {
|
|
3479
|
+
pageIndex: 0,
|
|
3480
|
+
pageSize: 10,
|
|
3481
|
+
pageCount: -1
|
|
3482
|
+
}
|
|
3483
|
+
};
|
|
3484
|
+
}
|
|
3485
|
+
function getDefaultOptions$1(instance) {
|
|
3486
|
+
return {
|
|
3487
|
+
onPaginationChange: makeStateUpdater('pagination', instance),
|
|
3488
|
+
autoResetPageIndex: true
|
|
3489
|
+
};
|
|
3490
|
+
}
|
|
3491
|
+
function getInstance$1(instance) {
|
|
3492
|
+
var registered = false;
|
|
3493
|
+
return {
|
|
3494
|
+
_notifyPageIndexReset: function _notifyPageIndexReset() {
|
|
3495
|
+
if (!registered) {
|
|
3496
|
+
registered = true;
|
|
3497
|
+
return;
|
|
3498
|
+
}
|
|
3499
|
+
|
|
3500
|
+
if (instance.options.autoResetAll === false) {
|
|
3501
|
+
return;
|
|
3502
|
+
}
|
|
3503
|
+
|
|
3504
|
+
if (instance.options.autoResetAll === true || instance.options.autoResetPageIndex) {
|
|
3505
|
+
instance.resetPageSize();
|
|
3506
|
+
}
|
|
3507
|
+
},
|
|
3508
|
+
setPagination: function setPagination(updater) {
|
|
3509
|
+
var safeUpdater = function safeUpdater(old) {
|
|
3510
|
+
functionalUpdate(old, updater);
|
|
3511
|
+
|
|
3512
|
+
if (!instance.options.paginateRowsFn) {
|
|
3513
|
+
var _instance$getPreExpan;
|
|
3514
|
+
|
|
3515
|
+
return _extends({}, old, {
|
|
3516
|
+
pageCount: (_instance$getPreExpan = instance.getPreExpandedRows()) != null && _instance$getPreExpan.length ? Math.ceil(instance.getPreExpandedRows().length / instance.getState().pagination.pageSize) : 0
|
|
3517
|
+
});
|
|
3518
|
+
}
|
|
3519
|
+
|
|
3520
|
+
return old;
|
|
3521
|
+
};
|
|
3522
|
+
|
|
3523
|
+
return instance.options.onPaginationChange == null ? void 0 : instance.options.onPaginationChange(safeUpdater, functionalUpdate(safeUpdater, instance.getState().pagination));
|
|
3524
|
+
},
|
|
3525
|
+
resetPagination: function resetPagination() {
|
|
3526
|
+
var _instance$initialStat;
|
|
3527
|
+
|
|
3528
|
+
instance.setPagination((_instance$initialStat = instance.initialState.pagination) != null ? _instance$initialStat : {
|
|
3529
|
+
pageIndex: 0,
|
|
3530
|
+
pageSize: 10,
|
|
3531
|
+
pageCount: -1
|
|
3532
|
+
});
|
|
3533
|
+
},
|
|
3534
|
+
setPageIndex: function setPageIndex(updater) {
|
|
3535
|
+
instance.setPagination(function (old) {
|
|
3536
|
+
var newPageIndex = functionalUpdate(updater, old.pageIndex);
|
|
3537
|
+
var maxPageIndex = old.pageCount > 0 ? old.pageCount - 1 : Number.MAX_SAFE_INTEGER;
|
|
3538
|
+
return _extends({}, old, {
|
|
3539
|
+
pageIndex: Math.min(Math.max(0, newPageIndex), maxPageIndex)
|
|
3540
|
+
});
|
|
3541
|
+
});
|
|
3542
|
+
},
|
|
3543
|
+
resetPageIndex: function resetPageIndex() {
|
|
3544
|
+
instance.setPageIndex(0);
|
|
3545
|
+
},
|
|
3546
|
+
resetPageSize: function resetPageSize() {
|
|
3547
|
+
var _instance$options$ini, _instance$options$ini2, _instance$options$ini3;
|
|
3548
|
+
|
|
3549
|
+
instance.setPageSize((_instance$options$ini = (_instance$options$ini2 = instance.options.initialState) == null ? void 0 : (_instance$options$ini3 = _instance$options$ini2.pagination) == null ? void 0 : _instance$options$ini3.pageSize) != null ? _instance$options$ini : 10);
|
|
3550
|
+
},
|
|
3551
|
+
setPageSize: function setPageSize(updater) {
|
|
3552
|
+
instance.setPagination(function (old) {
|
|
3553
|
+
var pageSize = Math.max(1, functionalUpdate(updater, old.pageSize));
|
|
3554
|
+
var topRowIndex = old.pageSize * old.pageIndex;
|
|
3555
|
+
var pageIndex = Math.floor(topRowIndex / pageSize);
|
|
3556
|
+
return _extends({}, old, {
|
|
3557
|
+
pageIndex: pageIndex,
|
|
3558
|
+
pageSize: pageSize
|
|
3559
|
+
});
|
|
3560
|
+
});
|
|
3561
|
+
},
|
|
3562
|
+
setPageCount: function setPageCount(updater) {
|
|
3563
|
+
return instance.setPagination(function (old) {
|
|
3564
|
+
return _extends({}, old, {
|
|
3565
|
+
pageCount: Math.max(-1, functionalUpdate(updater, old.pageCount))
|
|
3566
|
+
});
|
|
3567
|
+
});
|
|
3568
|
+
},
|
|
3569
|
+
getPageOptions: memo(function () {
|
|
3570
|
+
return [instance.getState().pagination.pageSize, instance.getState().pagination.pageCount];
|
|
3571
|
+
}, function (pageSize, pageCount) {
|
|
3572
|
+
var pageOptions = [];
|
|
3573
|
+
|
|
3574
|
+
if (pageCount > 0) {
|
|
3575
|
+
pageOptions = [].concat(new Array(pageCount)).fill(null).map(function (_, i) {
|
|
3576
|
+
return i;
|
|
3577
|
+
});
|
|
3578
|
+
}
|
|
3579
|
+
|
|
3580
|
+
return pageOptions;
|
|
3581
|
+
}, {
|
|
3582
|
+
key: 'getPageOptions',
|
|
3583
|
+
debug: instance.options.debug
|
|
3584
|
+
}),
|
|
3585
|
+
getCanPreviousPage: function getCanPreviousPage() {
|
|
3586
|
+
return instance.getState().pagination.pageIndex > 0;
|
|
3587
|
+
},
|
|
3588
|
+
getCanNextPage: function getCanNextPage() {
|
|
3589
|
+
var _instance$getState$pa = instance.getState().pagination,
|
|
3590
|
+
pageIndex = _instance$getState$pa.pageIndex,
|
|
3591
|
+
pageCount = _instance$getState$pa.pageCount,
|
|
3592
|
+
pageSize = _instance$getState$pa.pageSize;
|
|
3593
|
+
|
|
3594
|
+
if (pageCount === -1) {
|
|
3595
|
+
return true;
|
|
3596
|
+
}
|
|
3597
|
+
|
|
3598
|
+
if (pageCount === 0) {
|
|
3599
|
+
return false;
|
|
3600
|
+
}
|
|
3601
|
+
|
|
3602
|
+
return pageIndex < Math.ceil(instance.getPrePaginationRows().length / pageSize) - 1;
|
|
3603
|
+
},
|
|
3604
|
+
gotoPreviousPage: function gotoPreviousPage() {
|
|
3605
|
+
return instance.setPageIndex == null ? void 0 : instance.setPageIndex(function (old) {
|
|
3606
|
+
return old - 1;
|
|
3607
|
+
});
|
|
3608
|
+
},
|
|
3609
|
+
gotoNextPage: function gotoNextPage() {
|
|
3610
|
+
return instance.setPageIndex == null ? void 0 : instance.setPageIndex(function (old) {
|
|
3611
|
+
return old + 1;
|
|
3612
|
+
});
|
|
3613
|
+
},
|
|
3614
|
+
getPaginationRowModel: memo(function () {
|
|
3615
|
+
return [instance.getState().pagination, instance.getExpandedRowModel(), instance.options.paginateRowsFn];
|
|
3616
|
+
}, function (_pagination, rowModel, paginateRowsFn) {
|
|
3617
|
+
if (!paginateRowsFn || !rowModel.rows.length) {
|
|
3618
|
+
return rowModel;
|
|
3619
|
+
}
|
|
3620
|
+
|
|
3621
|
+
if (instance.options.debug) console.info('Paginating...');
|
|
3622
|
+
return paginateRowsFn(instance, rowModel);
|
|
3623
|
+
}, {
|
|
3624
|
+
key: 'getPaginationRowModel',
|
|
3625
|
+
debug: instance.options.debug
|
|
3626
|
+
}),
|
|
3627
|
+
getPrePaginationRows: function getPrePaginationRows() {
|
|
3628
|
+
return instance.getExpandedRowModel().rows;
|
|
3629
|
+
},
|
|
3630
|
+
getPrePaginationFlatRows: function getPrePaginationFlatRows() {
|
|
3631
|
+
return instance.getExpandedRowModel().flatRows;
|
|
3632
|
+
},
|
|
3633
|
+
getPrePaginationRowsById: function getPrePaginationRowsById() {
|
|
3634
|
+
return instance.getExpandedRowModel().rowsById;
|
|
3635
|
+
},
|
|
3636
|
+
getPaginationRows: function getPaginationRows() {
|
|
3637
|
+
return instance.getPaginationRowModel().rows;
|
|
3638
|
+
},
|
|
3639
|
+
getPaginationFlatRows: function getPaginationFlatRows() {
|
|
3640
|
+
return instance.getPaginationRowModel().flatRows;
|
|
3641
|
+
},
|
|
3642
|
+
getPaginationRowsById: function getPaginationRowsById() {
|
|
3643
|
+
return instance.getPaginationRowModel().rowsById;
|
|
3644
|
+
}
|
|
3645
|
+
};
|
|
3646
|
+
}
|
|
3647
|
+
|
|
3648
|
+
var Pagination = /*#__PURE__*/Object.freeze({
|
|
3649
|
+
__proto__: null,
|
|
3650
|
+
getInitialState: getInitialState$1,
|
|
3651
|
+
getDefaultOptions: getDefaultOptions$1,
|
|
3652
|
+
getInstance: getInstance$1
|
|
3653
|
+
});
|
|
3654
|
+
|
|
3655
|
+
//
|
|
3656
|
+
function getInitialState() {
|
|
3657
|
+
return {
|
|
3658
|
+
rowSelection: {}
|
|
3659
|
+
};
|
|
3660
|
+
}
|
|
3661
|
+
function getDefaultOptions(instance) {
|
|
3662
|
+
return {
|
|
3663
|
+
onRowSelectionChange: makeStateUpdater('rowSelection', instance),
|
|
3664
|
+
autoResetRowSelection: true,
|
|
3665
|
+
enableRowSelection: true,
|
|
3666
|
+
enableMultiRowSelection: true,
|
|
3667
|
+
enableSubRowSelection: true // enableGroupingRowSelection: false,
|
|
3668
|
+
// isAdditiveSelectEvent: (e: MouseEvent | TouchEvent) => !!e.metaKey,
|
|
3669
|
+
// isInclusiveSelectEvent: (e: MouseEvent | TouchEvent) => !!e.shiftKey,
|
|
3670
|
+
|
|
3671
|
+
};
|
|
3672
|
+
}
|
|
3673
|
+
function getInstance(instance) {
|
|
3674
|
+
var registered = false; // const pageRows = instance.getPageRows()
|
|
3675
|
+
|
|
3676
|
+
return {
|
|
3677
|
+
_notifyRowSelectionReset: function _notifyRowSelectionReset() {
|
|
3678
|
+
if (!registered) {
|
|
3679
|
+
registered = true;
|
|
3680
|
+
return;
|
|
3681
|
+
}
|
|
3682
|
+
|
|
3683
|
+
if (instance.options.autoResetAll === false) {
|
|
3684
|
+
return;
|
|
3685
|
+
}
|
|
3686
|
+
|
|
3687
|
+
if (instance.options.autoResetAll === true || instance.options.autoResetRowSelection) {
|
|
3688
|
+
instance.resetRowSelection();
|
|
3689
|
+
}
|
|
3690
|
+
},
|
|
3691
|
+
setRowSelection: function setRowSelection(updater) {
|
|
3692
|
+
return instance.options.onRowSelectionChange == null ? void 0 : instance.options.onRowSelectionChange(updater, functionalUpdate(updater, instance.getState().rowSelection));
|
|
3693
|
+
},
|
|
3694
|
+
resetRowSelection: function resetRowSelection() {
|
|
3695
|
+
var _getInitialState$rowS;
|
|
3696
|
+
|
|
3697
|
+
return instance.setRowSelection((_getInitialState$rowS = getInitialState().rowSelection) != null ? _getInitialState$rowS : {});
|
|
3698
|
+
},
|
|
3699
|
+
toggleAllRowsSelected: function toggleAllRowsSelected(value) {
|
|
3700
|
+
instance.setRowSelection(function (old) {
|
|
3701
|
+
value = typeof value !== 'undefined' ? value : !instance.getIsAllRowsSelected(); // Only remove/add the rows that are visible on the screen
|
|
3702
|
+
// Leave all the other rows that are selected alone.
|
|
3703
|
+
|
|
3704
|
+
var rowSelection = Object.assign({}, old);
|
|
3705
|
+
var preGroupedFlatRows = instance.getPreGroupedFlatRows(); // We don't use `mutateRowIsSelected` here for performance reasons.
|
|
3706
|
+
// All of the rows are flat already, so it wouldn't be worth it
|
|
3707
|
+
|
|
3708
|
+
if (value) {
|
|
3709
|
+
preGroupedFlatRows.forEach(function (row) {
|
|
3710
|
+
rowSelection[row.id] = true;
|
|
3711
|
+
});
|
|
3712
|
+
} else {
|
|
3713
|
+
preGroupedFlatRows.forEach(function (row) {
|
|
3714
|
+
delete rowSelection[row.id];
|
|
3715
|
+
});
|
|
3716
|
+
}
|
|
3717
|
+
|
|
3718
|
+
return rowSelection;
|
|
3719
|
+
});
|
|
3720
|
+
},
|
|
3721
|
+
toggleAllPageRowsSelected: function toggleAllPageRowsSelected(value) {
|
|
3722
|
+
return instance.setRowSelection(function (old) {
|
|
3723
|
+
typeof value !== 'undefined' ? value : !instance.getIsAllPageRowsSelected();
|
|
3724
|
+
|
|
3725
|
+
var rowSelection = _extends({}, old);
|
|
3726
|
+
|
|
3727
|
+
instance.getRows().forEach(function (row) {
|
|
3728
|
+
mutateRowIsSelected(rowSelection, row.id, value, instance);
|
|
3729
|
+
});
|
|
3730
|
+
return rowSelection;
|
|
3731
|
+
});
|
|
3732
|
+
},
|
|
3733
|
+
toggleRowSelected: function toggleRowSelected(rowId, value) {
|
|
3734
|
+
var row = instance.getRow(rowId);
|
|
3735
|
+
var isSelected = row.getIsSelected();
|
|
3736
|
+
instance.setRowSelection(function (old) {
|
|
3737
|
+
value = typeof value !== 'undefined' ? value : !isSelected;
|
|
3738
|
+
|
|
3739
|
+
if (isSelected === value) {
|
|
3740
|
+
return old;
|
|
3741
|
+
}
|
|
3742
|
+
|
|
3743
|
+
var selectedRowIds = _extends({}, old);
|
|
3744
|
+
|
|
3745
|
+
mutateRowIsSelected(selectedRowIds, rowId, value, instance);
|
|
3746
|
+
return selectedRowIds;
|
|
3747
|
+
});
|
|
3748
|
+
},
|
|
3749
|
+
// addRowSelectionRange: rowId => {
|
|
3750
|
+
// const {
|
|
3751
|
+
// rows,
|
|
3752
|
+
// rowsById,
|
|
3753
|
+
// options: { selectGroupingRows, selectSubRows },
|
|
3754
|
+
// } = instance
|
|
3755
|
+
// const findSelectedRow = (rows: Row[]) => {
|
|
3756
|
+
// let found
|
|
3757
|
+
// rows.find(d => {
|
|
3758
|
+
// if (d.getIsSelected()) {
|
|
3759
|
+
// found = d
|
|
3760
|
+
// return true
|
|
3761
|
+
// }
|
|
3762
|
+
// const subFound = findSelectedRow(d.subRows || [])
|
|
3763
|
+
// if (subFound) {
|
|
3764
|
+
// found = subFound
|
|
3765
|
+
// return true
|
|
3766
|
+
// }
|
|
3767
|
+
// return false
|
|
3768
|
+
// })
|
|
3769
|
+
// return found
|
|
3770
|
+
// }
|
|
3771
|
+
// const firstRow = findSelectedRow(rows) || rows[0]
|
|
3772
|
+
// const lastRow = rowsById[rowId]
|
|
3773
|
+
// let include = false
|
|
3774
|
+
// const selectedRowIds = {}
|
|
3775
|
+
// const addRow = (row: Row) => {
|
|
3776
|
+
// mutateRowIsSelected(selectedRowIds, row.id, true, {
|
|
3777
|
+
// rowsById,
|
|
3778
|
+
// selectGroupingRows: selectGroupingRows!,
|
|
3779
|
+
// selectSubRows: selectSubRows!,
|
|
3780
|
+
// })
|
|
3781
|
+
// }
|
|
3782
|
+
// instance.rows.forEach(row => {
|
|
3783
|
+
// const isFirstRow = row.id === firstRow.id
|
|
3784
|
+
// const isLastRow = row.id === lastRow.id
|
|
3785
|
+
// if (isFirstRow || isLastRow) {
|
|
3786
|
+
// if (!include) {
|
|
3787
|
+
// include = true
|
|
3788
|
+
// } else if (include) {
|
|
3789
|
+
// addRow(row)
|
|
3790
|
+
// include = false
|
|
3791
|
+
// }
|
|
3792
|
+
// }
|
|
3793
|
+
// if (include) {
|
|
3794
|
+
// addRow(row)
|
|
3795
|
+
// }
|
|
3796
|
+
// })
|
|
3797
|
+
// instance.setRowSelection(selectedRowIds)
|
|
3798
|
+
// },
|
|
3799
|
+
getSelectedRowModel: memo(function () {
|
|
3800
|
+
return [instance.getState().rowSelection, instance.getCoreRowModel()];
|
|
3801
|
+
}, function (rowSelection, rowModel) {
|
|
3802
|
+
if (!Object.keys(rowSelection).length) {
|
|
3803
|
+
return {
|
|
3804
|
+
rows: [],
|
|
3805
|
+
flatRows: [],
|
|
3806
|
+
rowsById: {}
|
|
3807
|
+
};
|
|
3808
|
+
}
|
|
3809
|
+
|
|
3810
|
+
if (instance.options.debug) console.info('Selecting...');
|
|
3811
|
+
return selectRowsFn(instance, rowModel);
|
|
3812
|
+
}, {
|
|
3813
|
+
key: 'getSelectedRowModel',
|
|
3814
|
+
debug: instance.options.debug,
|
|
3815
|
+
onChange: function onChange() {
|
|
3816
|
+
return instance._notifyExpandedReset();
|
|
3817
|
+
}
|
|
3818
|
+
}),
|
|
3819
|
+
getSelectedRows: function getSelectedRows() {
|
|
3820
|
+
return instance.getSelectedRowModel().rows;
|
|
3821
|
+
},
|
|
3822
|
+
getSelectedFlatRows: function getSelectedFlatRows() {
|
|
3823
|
+
return instance.getSelectedRowModel().flatRows;
|
|
3824
|
+
},
|
|
3825
|
+
getSelectedRowsById: function getSelectedRowsById() {
|
|
3826
|
+
return instance.getSelectedRowModel().rowsById;
|
|
3827
|
+
},
|
|
3828
|
+
getFilteredSelectedRowModel: memo(function () {
|
|
3829
|
+
return [instance.getState().rowSelection, instance.getGlobalFilteredRowModel()];
|
|
3830
|
+
}, function (rowSelection, rowModel) {
|
|
3831
|
+
if (!Object.keys(rowSelection).length) {
|
|
3832
|
+
return {
|
|
3833
|
+
rows: [],
|
|
3834
|
+
flatRows: [],
|
|
3835
|
+
rowsById: {}
|
|
3836
|
+
};
|
|
3837
|
+
}
|
|
3838
|
+
|
|
3839
|
+
if (instance.options.debug) console.info('Selecting...');
|
|
3840
|
+
return selectRowsFn(instance, rowModel);
|
|
3841
|
+
}, {
|
|
3842
|
+
key: 'getFilteredSelectedRowModel',
|
|
3843
|
+
debug: instance.options.debug,
|
|
3844
|
+
onChange: function onChange() {
|
|
3845
|
+
return instance._notifyExpandedReset();
|
|
3846
|
+
}
|
|
3847
|
+
}),
|
|
3848
|
+
getFilteredSelectedRows: function getFilteredSelectedRows() {
|
|
3849
|
+
return instance.getFilteredSelectedRowModel().rows;
|
|
3850
|
+
},
|
|
3851
|
+
getFilteredSelectedFlatRows: function getFilteredSelectedFlatRows() {
|
|
3852
|
+
return instance.getFilteredSelectedRowModel().flatRows;
|
|
3853
|
+
},
|
|
3854
|
+
getFilteredSelectedRowsById: function getFilteredSelectedRowsById() {
|
|
3855
|
+
return instance.getFilteredSelectedRowModel().rowsById;
|
|
3856
|
+
},
|
|
3857
|
+
getGroupedSelectedRowModel: memo(function () {
|
|
3858
|
+
return [instance.getState().rowSelection, instance.getGroupedRowModel()];
|
|
3859
|
+
}, function (rowSelection, rowModel) {
|
|
3860
|
+
if (!Object.keys(rowSelection).length) {
|
|
3861
|
+
return {
|
|
3862
|
+
rows: [],
|
|
3863
|
+
flatRows: [],
|
|
3864
|
+
rowsById: {}
|
|
3865
|
+
};
|
|
3866
|
+
}
|
|
3867
|
+
|
|
3868
|
+
if (instance.options.debug) console.info('Selecting...');
|
|
3869
|
+
return selectRowsFn(instance, rowModel);
|
|
3870
|
+
}, {
|
|
3871
|
+
key: 'getGroupedSelectedRowModel',
|
|
3872
|
+
debug: instance.options.debug,
|
|
3873
|
+
onChange: function onChange() {
|
|
3874
|
+
return instance._notifyExpandedReset();
|
|
3875
|
+
}
|
|
3876
|
+
}),
|
|
3877
|
+
getGroupedSelectedRows: function getGroupedSelectedRows() {
|
|
3878
|
+
return instance.getGroupedSelectedRowModel().rows;
|
|
3879
|
+
},
|
|
3880
|
+
getGroupedSelectedFlatRows: function getGroupedSelectedFlatRows() {
|
|
3881
|
+
return instance.getGroupedSelectedRowModel().flatRows;
|
|
3882
|
+
},
|
|
3883
|
+
getGroupedSelectedRowsById: function getGroupedSelectedRowsById() {
|
|
3884
|
+
return instance.getGroupedSelectedRowModel().rowsById;
|
|
3885
|
+
},
|
|
3886
|
+
///
|
|
3887
|
+
getRowIsSelected: function getRowIsSelected(rowId) {
|
|
3888
|
+
var _instance$getState = instance.getState(),
|
|
3889
|
+
rowSelection = _instance$getState.rowSelection;
|
|
3890
|
+
|
|
3891
|
+
var row = instance.getRow(rowId);
|
|
3892
|
+
|
|
3893
|
+
if (!row) {
|
|
3894
|
+
throw new Error();
|
|
3895
|
+
}
|
|
3896
|
+
|
|
3897
|
+
return isRowSelected(row, rowSelection) === true;
|
|
3898
|
+
},
|
|
3899
|
+
getRowIsSomeSelected: function getRowIsSomeSelected(rowId) {
|
|
3900
|
+
var _instance$getState2 = instance.getState(),
|
|
3901
|
+
rowSelection = _instance$getState2.rowSelection;
|
|
3902
|
+
|
|
3903
|
+
var row = instance.getRow(rowId);
|
|
3904
|
+
|
|
3905
|
+
if (!row) {
|
|
3906
|
+
throw new Error();
|
|
3907
|
+
}
|
|
3908
|
+
|
|
3909
|
+
return isRowSelected(row, rowSelection) === 'some';
|
|
3910
|
+
},
|
|
3911
|
+
getRowCanSelect: function getRowCanSelect(rowId) {
|
|
3912
|
+
var _instance$options$ena;
|
|
3913
|
+
|
|
3914
|
+
var row = instance.getRow(rowId);
|
|
3915
|
+
|
|
3916
|
+
if (!row) {
|
|
3917
|
+
throw new Error();
|
|
3918
|
+
}
|
|
3919
|
+
|
|
3920
|
+
if (typeof instance.options.enableRowSelection === 'function') {
|
|
3921
|
+
return instance.options.enableRowSelection(row);
|
|
3922
|
+
}
|
|
3923
|
+
|
|
3924
|
+
return (_instance$options$ena = instance.options.enableRowSelection) != null ? _instance$options$ena : true;
|
|
3925
|
+
},
|
|
3926
|
+
getRowCanSelectSubRows: function getRowCanSelectSubRows(rowId) {
|
|
3927
|
+
var _instance$options$ena2;
|
|
3928
|
+
|
|
3929
|
+
var row = instance.getRow(rowId);
|
|
3930
|
+
|
|
3931
|
+
if (!row) {
|
|
3932
|
+
throw new Error();
|
|
3933
|
+
}
|
|
3934
|
+
|
|
3935
|
+
if (typeof instance.options.enableSubRowSelection === 'function') {
|
|
3936
|
+
return instance.options.enableSubRowSelection(row);
|
|
3937
|
+
}
|
|
3938
|
+
|
|
3939
|
+
return (_instance$options$ena2 = instance.options.enableSubRowSelection) != null ? _instance$options$ena2 : true;
|
|
3940
|
+
},
|
|
3941
|
+
getRowCanMultiSelect: function getRowCanMultiSelect(rowId) {
|
|
3942
|
+
var _instance$options$ena3;
|
|
3943
|
+
|
|
3944
|
+
var row = instance.getRow(rowId);
|
|
3945
|
+
|
|
3946
|
+
if (!row) {
|
|
3947
|
+
throw new Error();
|
|
3948
|
+
}
|
|
3949
|
+
|
|
3950
|
+
if (typeof instance.options.enableMultiRowSelection === 'function') {
|
|
3951
|
+
return instance.options.enableMultiRowSelection(row);
|
|
3952
|
+
}
|
|
3953
|
+
|
|
3954
|
+
return (_instance$options$ena3 = instance.options.enableMultiRowSelection) != null ? _instance$options$ena3 : true;
|
|
3955
|
+
},
|
|
3956
|
+
// getGroupingRowCanSelect: rowId => {
|
|
3957
|
+
// const row = instance.getRow(rowId)
|
|
3958
|
+
// if (!row) {
|
|
3959
|
+
// throw new Error()
|
|
3960
|
+
// }
|
|
3961
|
+
// if (typeof instance.options.enableGroupingRowSelection === 'function') {
|
|
3962
|
+
// return instance.options.enableGroupingRowSelection(row)
|
|
3963
|
+
// }
|
|
3964
|
+
// return instance.options.enableGroupingRowSelection ?? false
|
|
3965
|
+
// },
|
|
3966
|
+
getIsAllRowsSelected: function getIsAllRowsSelected() {
|
|
3967
|
+
var preFilteredFlatRows = instance.getPreGlobalFilteredFlatRows();
|
|
3968
|
+
|
|
3969
|
+
var _instance$getState3 = instance.getState(),
|
|
3970
|
+
rowSelection = _instance$getState3.rowSelection;
|
|
3971
|
+
|
|
3972
|
+
var isAllRowsSelected = Boolean(preFilteredFlatRows.length && Object.keys(rowSelection).length);
|
|
3973
|
+
|
|
3974
|
+
if (isAllRowsSelected) {
|
|
3975
|
+
if (preFilteredFlatRows.some(function (row) {
|
|
3976
|
+
return !rowSelection[row.id];
|
|
3977
|
+
})) {
|
|
3978
|
+
isAllRowsSelected = false;
|
|
3979
|
+
}
|
|
3980
|
+
}
|
|
3981
|
+
|
|
3982
|
+
return isAllRowsSelected;
|
|
3983
|
+
},
|
|
3984
|
+
getIsAllPageRowsSelected: function getIsAllPageRowsSelected() {
|
|
3985
|
+
var paginationFlatRows = instance.getPaginationFlatRows();
|
|
3986
|
+
|
|
3987
|
+
var _instance$getState4 = instance.getState(),
|
|
3988
|
+
rowSelection = _instance$getState4.rowSelection;
|
|
3989
|
+
|
|
3990
|
+
var isAllPageRowsSelected = !!paginationFlatRows.length;
|
|
3991
|
+
|
|
3992
|
+
if (isAllPageRowsSelected && paginationFlatRows.some(function (row) {
|
|
3993
|
+
return !rowSelection[row.id];
|
|
3994
|
+
})) {
|
|
3995
|
+
isAllPageRowsSelected = false;
|
|
3996
|
+
}
|
|
3997
|
+
|
|
3998
|
+
return isAllPageRowsSelected;
|
|
3999
|
+
},
|
|
4000
|
+
getIsSomeRowsSelected: function getIsSomeRowsSelected() {
|
|
4001
|
+
var _instance$getState$ro;
|
|
4002
|
+
|
|
4003
|
+
return !instance.getIsAllRowsSelected() && !!Object.keys((_instance$getState$ro = instance.getState().rowSelection) != null ? _instance$getState$ro : {}).length;
|
|
4004
|
+
},
|
|
4005
|
+
getIsSomePageRowsSelected: function getIsSomePageRowsSelected() {
|
|
4006
|
+
var paginationFlatRows = instance.getPaginationFlatRows();
|
|
4007
|
+
return instance.getIsAllPageRowsSelected() ? false : !!(paginationFlatRows != null && paginationFlatRows.length);
|
|
4008
|
+
},
|
|
4009
|
+
getToggleRowSelectedProps: function getToggleRowSelectedProps(rowId, userProps) {
|
|
4010
|
+
var row = instance.getRow(rowId);
|
|
4011
|
+
var isSelected = row.getIsSelected();
|
|
4012
|
+
var isSomeSelected = row.getIsSomeSelected();
|
|
4013
|
+
var canSelect = row.getCanSelect();
|
|
4014
|
+
var initialProps = {
|
|
4015
|
+
onChange: canSelect ? function (e) {
|
|
4016
|
+
row.toggleSelected(e.target.checked);
|
|
4017
|
+
} : undefined,
|
|
4018
|
+
checked: isSelected,
|
|
4019
|
+
title: 'Toggle Row Selected',
|
|
4020
|
+
indeterminate: isSomeSelected // onChange: forInput
|
|
4021
|
+
// ? (e: Event) => e.stopPropagation()
|
|
4022
|
+
// : (e: Event) => {
|
|
4023
|
+
// if (instance.options.isAdditiveSelectEvent(e)) {
|
|
4024
|
+
// row.toggleSelected()
|
|
4025
|
+
// } else if (instance.options.isInclusiveSelectEvent(e)) {
|
|
4026
|
+
// instance.addRowSelectionRange(row.id)
|
|
4027
|
+
// } else {
|
|
4028
|
+
// instance.setRowSelection({})
|
|
4029
|
+
// row.toggleSelected()
|
|
4030
|
+
// }
|
|
4031
|
+
// if (props.onClick) props.onClick(e)
|
|
4032
|
+
// },
|
|
4033
|
+
|
|
4034
|
+
};
|
|
4035
|
+
return propGetter(initialProps, userProps);
|
|
4036
|
+
},
|
|
4037
|
+
getToggleAllRowsSelectedProps: function getToggleAllRowsSelectedProps(userProps) {
|
|
4038
|
+
var isSomeRowsSelected = instance.getIsSomeRowsSelected();
|
|
4039
|
+
var isAllRowsSelected = instance.getIsAllRowsSelected();
|
|
4040
|
+
var initialProps = {
|
|
4041
|
+
onChange: function onChange(e) {
|
|
4042
|
+
instance.toggleAllRowsSelected(e.target.checked);
|
|
4043
|
+
},
|
|
4044
|
+
checked: isAllRowsSelected,
|
|
4045
|
+
title: 'Toggle All Rows Selected',
|
|
4046
|
+
indeterminate: isSomeRowsSelected
|
|
4047
|
+
};
|
|
4048
|
+
return propGetter(initialProps, userProps);
|
|
4049
|
+
},
|
|
4050
|
+
getToggleAllPageRowsSelectedProps: function getToggleAllPageRowsSelectedProps(userProps) {
|
|
4051
|
+
var isSomePageRowsSelected = instance.getIsSomePageRowsSelected();
|
|
4052
|
+
var isAllPageRowsSelected = instance.getIsAllPageRowsSelected();
|
|
4053
|
+
var initialProps = {
|
|
4054
|
+
onChange: function onChange(e) {
|
|
4055
|
+
instance.toggleAllPageRowsSelected(e.target.checked);
|
|
4056
|
+
},
|
|
4057
|
+
checked: isAllPageRowsSelected,
|
|
4058
|
+
title: 'Toggle All Current Page Rows Selected',
|
|
4059
|
+
indeterminate: isSomePageRowsSelected
|
|
4060
|
+
};
|
|
4061
|
+
return propGetter(initialProps, userProps);
|
|
4062
|
+
}
|
|
4063
|
+
};
|
|
4064
|
+
}
|
|
4065
|
+
function createRow(row, instance) {
|
|
4066
|
+
return {
|
|
4067
|
+
getIsSelected: function getIsSelected() {
|
|
4068
|
+
return instance.getRowIsSelected(row.id);
|
|
4069
|
+
},
|
|
4070
|
+
getIsSomeSelected: function getIsSomeSelected() {
|
|
4071
|
+
return instance.getRowIsSomeSelected(row.id);
|
|
4072
|
+
},
|
|
4073
|
+
toggleSelected: function toggleSelected(value) {
|
|
4074
|
+
return instance.toggleRowSelected(row.id, value);
|
|
4075
|
+
},
|
|
4076
|
+
getToggleSelectedProps: function getToggleSelectedProps(userProps) {
|
|
4077
|
+
return instance.getToggleRowSelectedProps(row.id, userProps);
|
|
4078
|
+
},
|
|
4079
|
+
getCanMultiSelect: function getCanMultiSelect() {
|
|
4080
|
+
return instance.getRowCanMultiSelect(row.id);
|
|
4081
|
+
},
|
|
4082
|
+
getCanSelect: function getCanSelect() {
|
|
4083
|
+
return instance.getRowCanSelect(row.id);
|
|
4084
|
+
}
|
|
4085
|
+
};
|
|
4086
|
+
}
|
|
4087
|
+
|
|
4088
|
+
var mutateRowIsSelected = function mutateRowIsSelected(selectedRowIds, id, value, instance) {
|
|
4089
|
+
var _row$subRows;
|
|
4090
|
+
|
|
4091
|
+
var row = instance.getRow(id);
|
|
4092
|
+
row.getIsGrouped(); // if ( // TODO: enforce grouping row selection rules
|
|
4093
|
+
// !isGrouped ||
|
|
4094
|
+
// (isGrouped && instance.options.enableGroupingRowSelection)
|
|
4095
|
+
// ) {
|
|
4096
|
+
|
|
4097
|
+
if (value) {
|
|
4098
|
+
selectedRowIds[id] = true;
|
|
4099
|
+
} else {
|
|
4100
|
+
delete selectedRowIds[id];
|
|
4101
|
+
} // }
|
|
4102
|
+
|
|
4103
|
+
|
|
4104
|
+
if ((_row$subRows = row.subRows) != null && _row$subRows.length && instance.getRowCanSelectSubRows(row.id)) {
|
|
4105
|
+
row.subRows.forEach(function (row) {
|
|
4106
|
+
return mutateRowIsSelected(selectedRowIds, row.id, value, instance);
|
|
4107
|
+
});
|
|
4108
|
+
}
|
|
4109
|
+
};
|
|
4110
|
+
|
|
4111
|
+
function selectRowsFn(instance, rowModel) {
|
|
4112
|
+
var rowSelection = instance.getState().rowSelection;
|
|
4113
|
+
var newSelectedFlatRows = [];
|
|
4114
|
+
var newSelectedRowsById = {}; // Filters top level and nested rows
|
|
4115
|
+
|
|
4116
|
+
var recurseRows = function recurseRows(rows, depth) {
|
|
4117
|
+
|
|
4118
|
+
return rows.map(function (row) {
|
|
4119
|
+
var _row$subRows2;
|
|
4120
|
+
|
|
4121
|
+
var isSelected = isRowSelected(row, rowSelection) === true;
|
|
4122
|
+
|
|
4123
|
+
if (isSelected) {
|
|
4124
|
+
newSelectedFlatRows.push(row);
|
|
4125
|
+
newSelectedRowsById[row.id] = row;
|
|
4126
|
+
}
|
|
4127
|
+
|
|
4128
|
+
if ((_row$subRows2 = row.subRows) != null && _row$subRows2.length) {
|
|
4129
|
+
row = _extends({}, row, {
|
|
4130
|
+
subRows: recurseRows(row.subRows)
|
|
4131
|
+
});
|
|
4132
|
+
}
|
|
4133
|
+
|
|
4134
|
+
if (isSelected) {
|
|
4135
|
+
return row;
|
|
4136
|
+
}
|
|
4137
|
+
}).filter(Boolean);
|
|
4138
|
+
};
|
|
4139
|
+
|
|
4140
|
+
return {
|
|
4141
|
+
rows: recurseRows(rowModel.rows),
|
|
4142
|
+
flatRows: newSelectedFlatRows,
|
|
4143
|
+
rowsById: newSelectedRowsById
|
|
4144
|
+
};
|
|
4145
|
+
}
|
|
4146
|
+
function isRowSelected(row, selection, instance) {
|
|
4147
|
+
if (selection[row.id]) {
|
|
4148
|
+
return true;
|
|
4149
|
+
}
|
|
4150
|
+
|
|
4151
|
+
if (row.subRows && row.subRows.length) {
|
|
4152
|
+
var allChildrenSelected = true;
|
|
4153
|
+
var someSelected = false;
|
|
4154
|
+
row.subRows.forEach(function (subRow) {
|
|
4155
|
+
// Bail out early if we know both of these
|
|
4156
|
+
if (someSelected && !allChildrenSelected) {
|
|
4157
|
+
return;
|
|
4158
|
+
}
|
|
4159
|
+
|
|
4160
|
+
if (isRowSelected(subRow, selection)) {
|
|
4161
|
+
someSelected = true;
|
|
4162
|
+
} else {
|
|
4163
|
+
allChildrenSelected = false;
|
|
4164
|
+
}
|
|
4165
|
+
});
|
|
4166
|
+
return allChildrenSelected ? true : someSelected ? 'some' : false;
|
|
4167
|
+
}
|
|
4168
|
+
|
|
4169
|
+
return false;
|
|
4170
|
+
}
|
|
4171
|
+
|
|
4172
|
+
var RowSelection = /*#__PURE__*/Object.freeze({
|
|
4173
|
+
__proto__: null,
|
|
4174
|
+
getInitialState: getInitialState,
|
|
4175
|
+
getDefaultOptions: getDefaultOptions,
|
|
4176
|
+
getInstance: getInstance,
|
|
4177
|
+
createRow: createRow,
|
|
4178
|
+
selectRowsFn: selectRowsFn,
|
|
4179
|
+
isRowSelected: isRowSelected
|
|
4180
|
+
});
|
|
4181
|
+
|
|
4182
|
+
var features = [Visibility, Ordering, Pinning, Headers, Filters, Sorting, Grouping, Expanding, ColumnSizing, Pagination, RowSelection];
|
|
4183
|
+
function createTableInstance(options, rerender) {
|
|
4184
|
+
var _options$initialState;
|
|
4185
|
+
|
|
4186
|
+
if (options.debug) {
|
|
4187
|
+
console.info('Creating React Table Instance...');
|
|
4188
|
+
}
|
|
4189
|
+
|
|
4190
|
+
var instance = {};
|
|
4191
|
+
var defaultOptions = features.reduce(function (obj, feature) {
|
|
4192
|
+
return Object.assign(obj, feature.getDefaultOptions == null ? void 0 : feature.getDefaultOptions(instance));
|
|
4193
|
+
}, {});
|
|
4194
|
+
var defaultState = {};
|
|
4195
|
+
|
|
4196
|
+
var buildOptions = function buildOptions(options) {
|
|
4197
|
+
return _extends({
|
|
4198
|
+
state: defaultState
|
|
4199
|
+
}, defaultOptions, options);
|
|
4200
|
+
};
|
|
4201
|
+
|
|
4202
|
+
instance.options = buildOptions(options);
|
|
4203
|
+
|
|
4204
|
+
var initialState = _extends({}, features.reduce(function (obj, feature) {
|
|
4205
|
+
return Object.assign(obj, feature.getInitialState == null ? void 0 : feature.getInitialState());
|
|
4206
|
+
}, {}), (_options$initialState = options.initialState) != null ? _options$initialState : {});
|
|
4207
|
+
|
|
4208
|
+
var finalInstance = _extends({}, instance, features.reduce(function (obj, feature) {
|
|
4209
|
+
return Object.assign(obj, feature.getInstance == null ? void 0 : feature.getInstance(instance));
|
|
4210
|
+
}, {}), {
|
|
4211
|
+
rerender: rerender,
|
|
4212
|
+
initialState: initialState,
|
|
4213
|
+
internalState: initialState,
|
|
4214
|
+
reset: function reset() {
|
|
4215
|
+
instance.setState(instance.initialState);
|
|
4216
|
+
},
|
|
4217
|
+
updateOptions: function updateOptions(newOptions) {
|
|
4218
|
+
instance.options = buildOptions(newOptions);
|
|
4219
|
+
},
|
|
4220
|
+
getRowId: function getRowId(_, index, parent) {
|
|
4221
|
+
return "" + (parent ? [parent.id, index].join('.') : index);
|
|
4222
|
+
},
|
|
4223
|
+
getState: function getState() {
|
|
4224
|
+
var state = _extends({}, instance.internalState, instance.options.state);
|
|
4225
|
+
|
|
4226
|
+
return state;
|
|
4227
|
+
},
|
|
4228
|
+
setState: function setState(updater, shouldRerender) {
|
|
4229
|
+
if (shouldRerender === void 0) {
|
|
4230
|
+
shouldRerender = true;
|
|
4231
|
+
}
|
|
4232
|
+
|
|
4233
|
+
var onStateChange = instance.options.onStateChange;
|
|
4234
|
+
var internalState = instance.internalState;
|
|
4235
|
+
var newState = functionalUpdate(updater, internalState);
|
|
4236
|
+
instance.internalState = newState;
|
|
4237
|
+
|
|
4238
|
+
if (onStateChange) {
|
|
4239
|
+
onStateChange(newState);
|
|
4240
|
+
return;
|
|
4241
|
+
}
|
|
4242
|
+
|
|
4243
|
+
if (shouldRerender) {
|
|
4244
|
+
instance.rerender();
|
|
4245
|
+
}
|
|
4246
|
+
},
|
|
4247
|
+
getDefaultColumn: memo(function () {
|
|
4248
|
+
return [instance.options.defaultColumn];
|
|
4249
|
+
}, function (defaultColumn) {
|
|
4250
|
+
var _defaultColumn;
|
|
4251
|
+
|
|
4252
|
+
defaultColumn = (_defaultColumn = defaultColumn) != null ? _defaultColumn : {};
|
|
4253
|
+
return _extends({
|
|
4254
|
+
header: function header(props) {
|
|
4255
|
+
return props.header.column.id;
|
|
4256
|
+
},
|
|
4257
|
+
footer: function footer(props) {
|
|
4258
|
+
return props.header.column.id;
|
|
4259
|
+
},
|
|
4260
|
+
cell: function cell(_ref) {
|
|
4261
|
+
var _ref$value = _ref.value,
|
|
4262
|
+
value = _ref$value === void 0 ? '' : _ref$value;
|
|
4263
|
+
return typeof value === 'boolean' ? value.toString() : value;
|
|
4264
|
+
}
|
|
4265
|
+
}, features.reduce(function (obj, feature) {
|
|
4266
|
+
return Object.assign(obj, feature.getDefaultColumn == null ? void 0 : feature.getDefaultColumn());
|
|
4267
|
+
}, {}), defaultColumn);
|
|
4268
|
+
}, {
|
|
4269
|
+
debug: instance.options.debug,
|
|
4270
|
+
key: 'getDefaultColumn'
|
|
4271
|
+
}),
|
|
4272
|
+
getColumnDefs: function getColumnDefs() {
|
|
4273
|
+
return instance.options.columns;
|
|
4274
|
+
},
|
|
4275
|
+
createColumn: function createColumn(columnDef, depth, parent) {
|
|
4276
|
+
var _ref2, _columnDef$id;
|
|
4277
|
+
|
|
4278
|
+
var defaultColumn = instance.getDefaultColumn();
|
|
4279
|
+
var id = (_ref2 = (_columnDef$id = columnDef.id) != null ? _columnDef$id : columnDef.accessorKey) != null ? _ref2 : typeof columnDef.header === 'string' ? columnDef.header : undefined;
|
|
4280
|
+
var accessorFn;
|
|
4281
|
+
|
|
4282
|
+
if (columnDef.accessorFn) {
|
|
4283
|
+
accessorFn = columnDef.accessorFn;
|
|
4284
|
+
} else if (columnDef.accessorKey) {
|
|
4285
|
+
accessorFn = function accessorFn(originalRow) {
|
|
4286
|
+
return originalRow[columnDef.accessorKey];
|
|
4287
|
+
};
|
|
4288
|
+
}
|
|
4289
|
+
|
|
4290
|
+
if (!id) {
|
|
4291
|
+
{
|
|
4292
|
+
throw new Error(columnDef.accessorFn ? "Columns require an id when using an accessorFn" : "Columns require an id when using a non-string header");
|
|
4293
|
+
}
|
|
4294
|
+
}
|
|
4295
|
+
|
|
4296
|
+
var column = _extends({}, defaultColumnSizing, defaultColumn, columnDef, {
|
|
2981
4297
|
id: "" + id,
|
|
2982
4298
|
accessorFn: accessorFn,
|
|
2983
4299
|
parent: parent,
|
|
@@ -2995,7 +4311,10 @@
|
|
|
2995
4311
|
return [column].concat((_column$columns = column.columns) == null ? void 0 : _column$columns.flatMap(function (d) {
|
|
2996
4312
|
return d.getFlatColumns();
|
|
2997
4313
|
}));
|
|
2998
|
-
},
|
|
4314
|
+
}, {
|
|
4315
|
+
key: 'column.getFlatColumns',
|
|
4316
|
+
debug: instance.options.debug
|
|
4317
|
+
}),
|
|
2999
4318
|
getLeafColumns: memo(function () {
|
|
3000
4319
|
return [instance.getOrderColumnsFn()];
|
|
3001
4320
|
}, function (orderColumns) {
|
|
@@ -3009,10 +4328,15 @@
|
|
|
3009
4328
|
}
|
|
3010
4329
|
|
|
3011
4330
|
return [column];
|
|
3012
|
-
},
|
|
4331
|
+
}, {
|
|
4332
|
+
key: 'column.getLeafColumns',
|
|
4333
|
+
debug: instance.options.debug
|
|
4334
|
+
})
|
|
3013
4335
|
});
|
|
3014
4336
|
|
|
3015
|
-
column =
|
|
4337
|
+
column = features.reduce(function (obj, feature) {
|
|
4338
|
+
return Object.assign(obj, feature.createColumn == null ? void 0 : feature.createColumn(column, instance));
|
|
4339
|
+
}, column); // Yes, we have to convert instance to uknown, because we know more than the compiler here.
|
|
3016
4340
|
|
|
3017
4341
|
return column;
|
|
3018
4342
|
},
|
|
@@ -3034,14 +4358,20 @@
|
|
|
3034
4358
|
};
|
|
3035
4359
|
|
|
3036
4360
|
return recurseColumns(columnDefs);
|
|
3037
|
-
},
|
|
4361
|
+
}, {
|
|
4362
|
+
key: 'getAllColumns',
|
|
4363
|
+
debug: instance.options.debug
|
|
4364
|
+
}),
|
|
3038
4365
|
getAllFlatColumns: memo(function () {
|
|
3039
4366
|
return [instance.getAllColumns()];
|
|
3040
4367
|
}, function (allColumns) {
|
|
3041
4368
|
return allColumns.flatMap(function (column) {
|
|
3042
4369
|
return column.getFlatColumns();
|
|
3043
4370
|
});
|
|
3044
|
-
},
|
|
4371
|
+
}, {
|
|
4372
|
+
key: 'getAllFlatColumns',
|
|
4373
|
+
debug: instance.options.debug
|
|
4374
|
+
}),
|
|
3045
4375
|
getAllFlatColumnsById: memo(function () {
|
|
3046
4376
|
return [instance.getAllFlatColumns()];
|
|
3047
4377
|
}, function (flatColumns) {
|
|
@@ -3049,7 +4379,10 @@
|
|
|
3049
4379
|
acc[column.id] = column;
|
|
3050
4380
|
return acc;
|
|
3051
4381
|
}, {});
|
|
3052
|
-
},
|
|
4382
|
+
}, {
|
|
4383
|
+
key: 'getAllFlatColumnsById',
|
|
4384
|
+
debug: instance.options.debug
|
|
4385
|
+
}),
|
|
3053
4386
|
getAllLeafColumns: memo(function () {
|
|
3054
4387
|
return [instance.getAllColumns(), instance.getOrderColumnsFn()];
|
|
3055
4388
|
}, function (allColumns, orderColumns) {
|
|
@@ -3057,7 +4390,10 @@
|
|
|
3057
4390
|
return column.getLeafColumns();
|
|
3058
4391
|
});
|
|
3059
4392
|
return orderColumns(leafColumns);
|
|
3060
|
-
},
|
|
4393
|
+
}, {
|
|
4394
|
+
key: 'getAllLeafColumns',
|
|
4395
|
+
debug: instance.options.debug
|
|
4396
|
+
}),
|
|
3061
4397
|
getColumn: function getColumn(columnId) {
|
|
3062
4398
|
var column = instance.getAllFlatColumnsById()[columnId];
|
|
3063
4399
|
|
|
@@ -3072,7 +4408,7 @@
|
|
|
3072
4408
|
return column;
|
|
3073
4409
|
},
|
|
3074
4410
|
getColumnWidth: function getColumnWidth(columnId) {
|
|
3075
|
-
var _column$minWidth,
|
|
4411
|
+
var _column$minWidth, _ref3, _column$maxWidth;
|
|
3076
4412
|
|
|
3077
4413
|
var column = instance.getColumn(columnId);
|
|
3078
4414
|
|
|
@@ -3080,9 +4416,10 @@
|
|
|
3080
4416
|
throw new Error();
|
|
3081
4417
|
}
|
|
3082
4418
|
|
|
3083
|
-
|
|
4419
|
+
var columnSize = instance.getState().columnSizing[column.id];
|
|
4420
|
+
return Math.min(Math.max((_column$minWidth = column.minWidth) != null ? _column$minWidth : defaultColumnSizing.minWidth, (_ref3 = columnSize != null ? columnSize : column.width) != null ? _ref3 : defaultColumnSizing.width), (_column$maxWidth = column.maxWidth) != null ? _column$maxWidth : defaultColumnSizing.maxWidth);
|
|
3084
4421
|
},
|
|
3085
|
-
createCell: function createCell
|
|
4422
|
+
createCell: function createCell(row, column, value) {
|
|
3086
4423
|
var cell = {
|
|
3087
4424
|
id: row.id + "_" + column.id,
|
|
3088
4425
|
rowId: row.id,
|
|
@@ -3095,16 +4432,20 @@
|
|
|
3095
4432
|
},
|
|
3096
4433
|
renderCell: function renderCell() {
|
|
3097
4434
|
return flexRender(column.cell, {
|
|
4435
|
+
instance: instance,
|
|
3098
4436
|
column: column,
|
|
4437
|
+
row: row,
|
|
3099
4438
|
cell: cell,
|
|
3100
4439
|
value: value
|
|
3101
4440
|
});
|
|
3102
4441
|
}
|
|
3103
4442
|
};
|
|
3104
|
-
|
|
4443
|
+
features.forEach(function (feature) {
|
|
4444
|
+
Object.assign(cell, feature.createCell == null ? void 0 : feature.createCell(cell, column, row, instance));
|
|
4445
|
+
}, {});
|
|
3105
4446
|
return cell;
|
|
3106
4447
|
},
|
|
3107
|
-
createRow: function createRow
|
|
4448
|
+
createRow: function createRow(id, original, rowIndex, depth, values) {
|
|
3108
4449
|
var row = {
|
|
3109
4450
|
id: id,
|
|
3110
4451
|
index: rowIndex,
|
|
@@ -3125,7 +4466,10 @@
|
|
|
3125
4466
|
return leafColumns.map(function (column) {
|
|
3126
4467
|
return instance.createCell(row, column, row.values[column.id]);
|
|
3127
4468
|
});
|
|
3128
|
-
},
|
|
4469
|
+
}, {
|
|
4470
|
+
key: 'row.getAllCells' ,
|
|
4471
|
+
debug: instance.options.debug
|
|
4472
|
+
});
|
|
3129
4473
|
row.getAllCellsByColumnId = memo(function () {
|
|
3130
4474
|
return [row.getAllCells()];
|
|
3131
4475
|
}, function (allCells) {
|
|
@@ -3133,42 +4477,19 @@
|
|
|
3133
4477
|
acc[cell.columnId] = cell;
|
|
3134
4478
|
return acc;
|
|
3135
4479
|
}, {});
|
|
3136
|
-
},
|
|
3137
|
-
|
|
4480
|
+
}, {
|
|
4481
|
+
key: 'row.getAllCellsByColumnId',
|
|
4482
|
+
debug: instance.options.debug
|
|
4483
|
+
});
|
|
4484
|
+
features.forEach(function (feature) {
|
|
4485
|
+
Object.assign(row, feature.createRow == null ? void 0 : feature.createRow(row, instance));
|
|
4486
|
+
});
|
|
3138
4487
|
return row;
|
|
3139
4488
|
},
|
|
3140
4489
|
getCoreRowModel: memo(function () {
|
|
3141
4490
|
return [instance.options.data];
|
|
3142
4491
|
}, function (data) {
|
|
3143
|
-
if (instance.options.debug) console.info('Accessing...'); //
|
|
3144
|
-
|
|
3145
|
-
if (instance.options.autoResetColumnFilters && // @ts-ignore
|
|
3146
|
-
instance.getRowModelNonFirst) {
|
|
3147
|
-
instance.resetColumnFilters();
|
|
3148
|
-
}
|
|
3149
|
-
|
|
3150
|
-
if (instance.options.autoResetGlobalFilter && // @ts-ignore
|
|
3151
|
-
instance.getRowModelNonFirst) {
|
|
3152
|
-
instance.resetGlobalFilter();
|
|
3153
|
-
}
|
|
3154
|
-
|
|
3155
|
-
if (instance.options.autoResetSorting && // @ts-ignore
|
|
3156
|
-
instance.getRowModelNonFirst) {
|
|
3157
|
-
instance.resetSorting();
|
|
3158
|
-
}
|
|
3159
|
-
|
|
3160
|
-
if (instance.options.autoResetGrouping && // @ts-ignore
|
|
3161
|
-
instance.getRowModelNonFirst) {
|
|
3162
|
-
instance.resetGrouping();
|
|
3163
|
-
}
|
|
3164
|
-
|
|
3165
|
-
if (instance.options.autoResetExpanded && // @ts-ignore
|
|
3166
|
-
instance.getRowModelNonFirst) {
|
|
3167
|
-
instance.resetExpanded();
|
|
3168
|
-
} // @ts-ignore
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
instance.getRowModelNonFirst = true; // Access the row model using initial columns
|
|
4492
|
+
if (instance.options.debug) console.info('Accessing...'); // Access the row model using initial columns
|
|
3172
4493
|
|
|
3173
4494
|
var rows = [];
|
|
3174
4495
|
var flatRows = [];
|
|
@@ -3236,7 +4557,15 @@
|
|
|
3236
4557
|
flatRows: flatRows,
|
|
3237
4558
|
rowsById: rowsById
|
|
3238
4559
|
};
|
|
3239
|
-
},
|
|
4560
|
+
}, {
|
|
4561
|
+
key: 'getRowModel',
|
|
4562
|
+
debug: instance.options.debug,
|
|
4563
|
+
onChange: function onChange() {
|
|
4564
|
+
instance._notifyRowSelectionReset();
|
|
4565
|
+
|
|
4566
|
+
instance._notifyFiltersReset();
|
|
4567
|
+
}
|
|
4568
|
+
}),
|
|
3240
4569
|
// The standard
|
|
3241
4570
|
getCoreRows: function getCoreRows() {
|
|
3242
4571
|
return instance.getCoreRowModel().rows;
|
|
@@ -3324,10 +4653,44 @@
|
|
|
3324
4653
|
key: cell.id,
|
|
3325
4654
|
role: 'gridcell'
|
|
3326
4655
|
}, userProps);
|
|
4656
|
+
},
|
|
4657
|
+
getTableWidth: function getTableWidth() {
|
|
4658
|
+
var _instance$getHeaderGr, _instance$getHeaderGr2;
|
|
4659
|
+
|
|
4660
|
+
return (_instance$getHeaderGr = (_instance$getHeaderGr2 = instance.getHeaderGroups()[0]) == null ? void 0 : _instance$getHeaderGr2.headers.reduce(function (sum, header) {
|
|
4661
|
+
return sum + header.getWidth();
|
|
4662
|
+
}, 0)) != null ? _instance$getHeaderGr : 0;
|
|
4663
|
+
},
|
|
4664
|
+
getLeftTableWidth: function getLeftTableWidth() {
|
|
4665
|
+
var _instance$getLeftHead, _instance$getLeftHead2;
|
|
4666
|
+
|
|
4667
|
+
return (_instance$getLeftHead = (_instance$getLeftHead2 = instance.getLeftHeaderGroups()[0]) == null ? void 0 : _instance$getLeftHead2.headers.reduce(function (sum, header) {
|
|
4668
|
+
return sum + header.getWidth();
|
|
4669
|
+
}, 0)) != null ? _instance$getLeftHead : 0;
|
|
4670
|
+
},
|
|
4671
|
+
getCenterTableWidth: function getCenterTableWidth() {
|
|
4672
|
+
var _instance$getCenterHe, _instance$getCenterHe2;
|
|
4673
|
+
|
|
4674
|
+
return (_instance$getCenterHe = (_instance$getCenterHe2 = instance.getCenterHeaderGroups()[0]) == null ? void 0 : _instance$getCenterHe2.headers.reduce(function (sum, header) {
|
|
4675
|
+
return sum + header.getWidth();
|
|
4676
|
+
}, 0)) != null ? _instance$getCenterHe : 0;
|
|
4677
|
+
},
|
|
4678
|
+
getRightTableWidth: function getRightTableWidth() {
|
|
4679
|
+
var _instance$getRightHea, _instance$getRightHea2;
|
|
4680
|
+
|
|
4681
|
+
return (_instance$getRightHea = (_instance$getRightHea2 = instance.getRightHeaderGroups()[0]) == null ? void 0 : _instance$getRightHea2.headers.reduce(function (sum, header) {
|
|
4682
|
+
return sum + header.getWidth();
|
|
4683
|
+
}, 0)) != null ? _instance$getRightHea : 0;
|
|
3327
4684
|
}
|
|
3328
4685
|
});
|
|
3329
4686
|
|
|
3330
|
-
|
|
4687
|
+
instance = Object.assign(instance, finalInstance); // This won't trigger a rerender yet, but it will force
|
|
4688
|
+
// pagination derivation to run (particularly pageSize detection)
|
|
4689
|
+
|
|
4690
|
+
instance.setPagination(function (d) {
|
|
4691
|
+
return d;
|
|
4692
|
+
});
|
|
4693
|
+
return instance;
|
|
3331
4694
|
}
|
|
3332
4695
|
|
|
3333
4696
|
function createTable() {
|
|
@@ -3347,7 +4710,17 @@
|
|
|
3347
4710
|
createColumns: function createColumns(columns) {
|
|
3348
4711
|
return columns;
|
|
3349
4712
|
},
|
|
3350
|
-
|
|
4713
|
+
createDisplayColumn: function createDisplayColumn(column) {
|
|
4714
|
+
return _extends({}, column, {
|
|
4715
|
+
__generated: true
|
|
4716
|
+
});
|
|
4717
|
+
},
|
|
4718
|
+
createGroup: function createGroup(column) {
|
|
4719
|
+
return _extends({}, column, {
|
|
4720
|
+
__generated: true
|
|
4721
|
+
});
|
|
4722
|
+
},
|
|
4723
|
+
createDataColumn: function createDataColumn(accessor, column) {
|
|
3351
4724
|
column = _extends({}, column, {
|
|
3352
4725
|
id: column.id
|
|
3353
4726
|
});
|
|
@@ -3371,11 +4744,6 @@
|
|
|
3371
4744
|
|
|
3372
4745
|
throw new Error('Invalid accessor');
|
|
3373
4746
|
},
|
|
3374
|
-
createGroup: function createGroup(column) {
|
|
3375
|
-
return _extends({}, column, {
|
|
3376
|
-
__generated: true
|
|
3377
|
-
});
|
|
3378
|
-
},
|
|
3379
4747
|
useTable: function useTable(options) {
|
|
3380
4748
|
var instanceRef = React__namespace.useRef(undefined);
|
|
3381
4749
|
var rerender = React__namespace.useReducer(function () {
|
|
@@ -3403,4 +4771,4 @@
|
|
|
3403
4771
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
3404
4772
|
|
|
3405
4773
|
}));
|
|
3406
|
-
//# sourceMappingURL=
|
|
4774
|
+
//# sourceMappingURL=index.development.js.map
|