@tanstack/table-core 9.0.0-beta.15 → 9.0.0-beta.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/cells/constructCell.d.cts +2 -2
- package/dist/core/cells/constructCell.d.ts +2 -2
- package/dist/core/cells/coreCellsFeature.types.d.cts +2 -2
- package/dist/core/cells/coreCellsFeature.types.d.ts +2 -2
- package/dist/core/cells/coreCellsFeature.utils.d.cts +2 -2
- package/dist/core/cells/coreCellsFeature.utils.d.ts +2 -2
- package/dist/core/columns/constructColumn.d.cts +2 -2
- package/dist/core/columns/constructColumn.d.ts +2 -2
- package/dist/core/columns/coreColumnsFeature.types.d.cts +2 -2
- package/dist/core/columns/coreColumnsFeature.types.d.ts +2 -2
- package/dist/core/columns/coreColumnsFeature.utils.cjs +2 -2
- package/dist/core/columns/coreColumnsFeature.utils.cjs.map +1 -1
- package/dist/core/columns/coreColumnsFeature.utils.d.cts +8 -8
- package/dist/core/columns/coreColumnsFeature.utils.d.ts +8 -8
- package/dist/core/columns/coreColumnsFeature.utils.js +3 -3
- package/dist/core/columns/coreColumnsFeature.utils.js.map +1 -1
- package/dist/core/headers/buildHeaderGroups.d.cts +2 -2
- package/dist/core/headers/buildHeaderGroups.d.ts +2 -2
- package/dist/core/headers/constructHeader.d.cts +2 -2
- package/dist/core/headers/constructHeader.d.ts +2 -2
- package/dist/core/headers/coreHeadersFeature.utils.d.cts +6 -6
- package/dist/core/headers/coreHeadersFeature.utils.d.ts +6 -6
- package/dist/core/row-models/coreRowModelsFeature.utils.d.cts +13 -13
- package/dist/core/row-models/coreRowModelsFeature.utils.d.ts +13 -13
- package/dist/core/row-models/createCoreRowModel.cjs +1 -1
- package/dist/core/row-models/createCoreRowModel.cjs.map +1 -1
- package/dist/core/row-models/createCoreRowModel.d.cts +2 -2
- package/dist/core/row-models/createCoreRowModel.d.ts +2 -2
- package/dist/core/row-models/createCoreRowModel.js +2 -2
- package/dist/core/row-models/createCoreRowModel.js.map +1 -1
- package/dist/core/rows/constructRow.cjs +3 -2
- package/dist/core/rows/constructRow.cjs.map +1 -1
- package/dist/core/rows/constructRow.d.cts +2 -2
- package/dist/core/rows/constructRow.d.ts +2 -2
- package/dist/core/rows/constructRow.js +4 -2
- package/dist/core/rows/constructRow.js.map +1 -1
- package/dist/core/rows/coreRowsFeature.types.d.cts +2 -2
- package/dist/core/rows/coreRowsFeature.types.d.ts +2 -2
- package/dist/core/rows/coreRowsFeature.utils.cjs +3 -3
- package/dist/core/rows/coreRowsFeature.utils.cjs.map +1 -1
- package/dist/core/rows/coreRowsFeature.utils.d.cts +3 -3
- package/dist/core/rows/coreRowsFeature.utils.d.ts +3 -3
- package/dist/core/rows/coreRowsFeature.utils.js +4 -4
- package/dist/core/rows/coreRowsFeature.utils.js.map +1 -1
- package/dist/core/table/coreTablesFeature.types.d.cts +1 -1
- package/dist/core/table/coreTablesFeature.types.d.ts +1 -1
- package/dist/core/table/coreTablesFeature.utils.d.cts +5 -5
- package/dist/core/table/coreTablesFeature.utils.d.ts +5 -5
- package/dist/features/column-faceting/columnFacetingFeature.utils.d.cts +8 -8
- package/dist/features/column-faceting/columnFacetingFeature.utils.d.ts +8 -8
- package/dist/features/column-filtering/columnFilteringFeature.cjs +2 -2
- package/dist/features/column-filtering/columnFilteringFeature.cjs.map +1 -1
- package/dist/features/column-filtering/columnFilteringFeature.js +3 -3
- package/dist/features/column-filtering/columnFilteringFeature.js.map +1 -1
- package/dist/features/column-filtering/columnFilteringFeature.utils.d.cts +12 -12
- package/dist/features/column-filtering/columnFilteringFeature.utils.d.ts +12 -12
- package/dist/features/column-filtering/createFilteredRowModel.cjs +8 -5
- package/dist/features/column-filtering/createFilteredRowModel.cjs.map +1 -1
- package/dist/features/column-filtering/createFilteredRowModel.js +9 -6
- package/dist/features/column-filtering/createFilteredRowModel.js.map +1 -1
- package/dist/features/column-filtering/filterRowsUtils.cjs +3 -2
- package/dist/features/column-filtering/filterRowsUtils.cjs.map +1 -1
- package/dist/features/column-filtering/filterRowsUtils.js +3 -2
- package/dist/features/column-filtering/filterRowsUtils.js.map +1 -1
- package/dist/features/column-grouping/columnGroupingFeature.cjs +1 -1
- package/dist/features/column-grouping/columnGroupingFeature.cjs.map +1 -1
- package/dist/features/column-grouping/columnGroupingFeature.js +2 -2
- package/dist/features/column-grouping/columnGroupingFeature.js.map +1 -1
- package/dist/features/column-grouping/columnGroupingFeature.utils.cjs +3 -3
- package/dist/features/column-grouping/columnGroupingFeature.utils.cjs.map +1 -1
- package/dist/features/column-grouping/columnGroupingFeature.utils.d.cts +11 -11
- package/dist/features/column-grouping/columnGroupingFeature.utils.d.ts +11 -11
- package/dist/features/column-grouping/columnGroupingFeature.utils.js +4 -4
- package/dist/features/column-grouping/columnGroupingFeature.utils.js.map +1 -1
- package/dist/features/column-grouping/createGroupedRowModel.cjs +4 -5
- package/dist/features/column-grouping/createGroupedRowModel.cjs.map +1 -1
- package/dist/features/column-grouping/createGroupedRowModel.js +5 -6
- package/dist/features/column-grouping/createGroupedRowModel.js.map +1 -1
- package/dist/features/column-ordering/columnOrderingFeature.utils.d.cts +9 -9
- package/dist/features/column-ordering/columnOrderingFeature.utils.d.ts +9 -9
- package/dist/features/column-pinning/columnPinningFeature.utils.d.cts +29 -29
- package/dist/features/column-pinning/columnPinningFeature.utils.d.ts +29 -29
- package/dist/features/column-resizing/columnResizingFeature.utils.cjs +2 -5
- package/dist/features/column-resizing/columnResizingFeature.utils.cjs.map +1 -1
- package/dist/features/column-resizing/columnResizingFeature.utils.d.cts +6 -6
- package/dist/features/column-resizing/columnResizingFeature.utils.d.ts +6 -6
- package/dist/features/column-resizing/columnResizingFeature.utils.js +3 -6
- package/dist/features/column-resizing/columnResizingFeature.utils.js.map +1 -1
- package/dist/features/column-sizing/columnSizingFeature.utils.cjs +11 -4
- package/dist/features/column-sizing/columnSizingFeature.utils.cjs.map +1 -1
- package/dist/features/column-sizing/columnSizingFeature.utils.d.cts +12 -12
- package/dist/features/column-sizing/columnSizingFeature.utils.d.ts +12 -12
- package/dist/features/column-sizing/columnSizingFeature.utils.js +12 -5
- package/dist/features/column-sizing/columnSizingFeature.utils.js.map +1 -1
- package/dist/features/column-visibility/columnVisibilityFeature.utils.cjs +12 -9
- package/dist/features/column-visibility/columnVisibilityFeature.utils.cjs.map +1 -1
- package/dist/features/column-visibility/columnVisibilityFeature.utils.d.cts +14 -14
- package/dist/features/column-visibility/columnVisibilityFeature.utils.d.ts +14 -14
- package/dist/features/column-visibility/columnVisibilityFeature.utils.js +13 -10
- package/dist/features/column-visibility/columnVisibilityFeature.utils.js.map +1 -1
- package/dist/features/global-filtering/globalFilteringFeature.utils.d.cts +6 -6
- package/dist/features/global-filtering/globalFilteringFeature.utils.d.ts +6 -6
- package/dist/features/row-expanding/rowExpandingFeature.utils.cjs +21 -12
- package/dist/features/row-expanding/rowExpandingFeature.utils.cjs.map +1 -1
- package/dist/features/row-expanding/rowExpandingFeature.utils.d.cts +10 -10
- package/dist/features/row-expanding/rowExpandingFeature.utils.d.ts +10 -10
- package/dist/features/row-expanding/rowExpandingFeature.utils.js +22 -13
- package/dist/features/row-expanding/rowExpandingFeature.utils.js.map +1 -1
- package/dist/features/row-pagination/rowPaginationFeature.utils.d.cts +17 -17
- package/dist/features/row-pagination/rowPaginationFeature.utils.d.ts +17 -17
- package/dist/features/row-pinning/rowPinningFeature.utils.d.cts +7 -7
- package/dist/features/row-pinning/rowPinningFeature.utils.d.ts +7 -7
- package/dist/features/row-selection/rowSelectionFeature.utils.cjs +15 -12
- package/dist/features/row-selection/rowSelectionFeature.utils.cjs.map +1 -1
- package/dist/features/row-selection/rowSelectionFeature.utils.d.cts +27 -15
- package/dist/features/row-selection/rowSelectionFeature.utils.d.ts +27 -15
- package/dist/features/row-selection/rowSelectionFeature.utils.js +16 -13
- package/dist/features/row-selection/rowSelectionFeature.utils.js.map +1 -1
- package/dist/features/row-sorting/createSortedRowModel.cjs +1 -1
- package/dist/features/row-sorting/createSortedRowModel.cjs.map +1 -1
- package/dist/features/row-sorting/createSortedRowModel.js +2 -2
- package/dist/features/row-sorting/createSortedRowModel.js.map +1 -1
- package/dist/features/row-sorting/rowSortingFeature.utils.d.cts +16 -16
- package/dist/features/row-sorting/rowSortingFeature.utils.d.ts +16 -16
- package/dist/index.cjs +2 -0
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +2 -2
- package/dist/types/Column.d.cts +2 -4
- package/dist/types/Column.d.ts +2 -4
- package/dist/types/Table.d.cts +3 -16
- package/dist/types/Table.d.ts +3 -16
- package/dist/types/TableFeatures.d.cts +7 -7
- package/dist/types/TableFeatures.d.ts +7 -7
- package/dist/utils.cjs +24 -2
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.cts +16 -5
- package/dist/utils.d.ts +16 -5
- package/dist/utils.js +23 -3
- package/dist/utils.js.map +1 -1
- package/package.json +2 -2
- package/src/core/columns/coreColumnsFeature.utils.ts +3 -3
- package/src/core/headers/coreHeadersFeature.types.ts +2 -2
- package/src/core/row-models/createCoreRowModel.ts +2 -2
- package/src/core/rows/constructRow.ts +3 -2
- package/src/core/rows/coreRowsFeature.utils.ts +4 -4
- package/src/features/column-filtering/columnFilteringFeature.ts +3 -2
- package/src/features/column-filtering/createFilteredRowModel.ts +13 -10
- package/src/features/column-filtering/filterRowsUtils.ts +3 -2
- package/src/features/column-grouping/columnGroupingFeature.ts +2 -1
- package/src/features/column-grouping/columnGroupingFeature.utils.ts +2 -2
- package/src/features/column-grouping/createGroupedRowModel.ts +10 -5
- package/src/features/column-resizing/columnResizingFeature.utils.ts +5 -6
- package/src/features/column-sizing/columnSizingFeature.utils.ts +27 -5
- package/src/features/column-visibility/columnVisibilityFeature.utils.ts +31 -15
- package/src/features/row-expanding/rowExpandingFeature.utils.ts +38 -13
- package/src/features/row-selection/rowSelectionFeature.utils.ts +35 -13
- package/src/features/row-sorting/createSortedRowModel.ts +6 -9
- package/src/types/Column.ts +3 -1
- package/src/utils.ts +24 -2
|
@@ -2,7 +2,7 @@ import { RowData } from "../../types/type-utils.js";
|
|
|
2
2
|
import { HeaderGroup } from "../../types/HeaderGroup.js";
|
|
3
3
|
import { Header } from "../../types/Header.js";
|
|
4
4
|
import { Column } from "../../types/Column.js";
|
|
5
|
-
import {
|
|
5
|
+
import { Table } from "../../types/Table.js";
|
|
6
6
|
import { TableFeatures } from "../../types/TableFeatures.js";
|
|
7
7
|
//#region src/core/headers/coreHeadersFeature.utils.d.ts
|
|
8
8
|
/**
|
|
@@ -30,7 +30,7 @@ declare function header_getLeafHeaders<TFeatures extends TableFeatures, TData ex
|
|
|
30
30
|
declare function header_getContext<TFeatures extends TableFeatures, TData extends RowData, TValue>(header: Header<TFeatures, TData, TValue>): {
|
|
31
31
|
column: Column<TFeatures, TData, TValue>;
|
|
32
32
|
header: Header<TFeatures, TData, TValue>;
|
|
33
|
-
table:
|
|
33
|
+
table: Table<TFeatures, TData>;
|
|
34
34
|
};
|
|
35
35
|
/**
|
|
36
36
|
* Builds visible header groups for the current column tree.
|
|
@@ -43,7 +43,7 @@ declare function header_getContext<TFeatures extends TableFeatures, TData extend
|
|
|
43
43
|
* const headerGroups = table_getHeaderGroups(table)
|
|
44
44
|
* ```
|
|
45
45
|
*/
|
|
46
|
-
declare function table_getHeaderGroups<TFeatures extends TableFeatures, TData extends RowData>(table:
|
|
46
|
+
declare function table_getHeaderGroups<TFeatures extends TableFeatures, TData extends RowData>(table: Table<TFeatures, TData>): HeaderGroup<TFeatures, TData>[];
|
|
47
47
|
/**
|
|
48
48
|
* Builds footer groups by reversing the current header groups.
|
|
49
49
|
*
|
|
@@ -55,7 +55,7 @@ declare function table_getHeaderGroups<TFeatures extends TableFeatures, TData ex
|
|
|
55
55
|
* const footerGroups = table_getFooterGroups(table)
|
|
56
56
|
* ```
|
|
57
57
|
*/
|
|
58
|
-
declare function table_getFooterGroups<TFeatures extends TableFeatures, TData extends RowData>(table:
|
|
58
|
+
declare function table_getFooterGroups<TFeatures extends TableFeatures, TData extends RowData>(table: Table<TFeatures, TData>): HeaderGroup<TFeatures, TData>[];
|
|
59
59
|
/**
|
|
60
60
|
* Flattens every header from every header group into one array.
|
|
61
61
|
*
|
|
@@ -67,7 +67,7 @@ declare function table_getFooterGroups<TFeatures extends TableFeatures, TData ex
|
|
|
67
67
|
* const flatHeaders = table_getFlatHeaders(table)
|
|
68
68
|
* ```
|
|
69
69
|
*/
|
|
70
|
-
declare function table_getFlatHeaders<TFeatures extends TableFeatures, TData extends RowData>(table:
|
|
70
|
+
declare function table_getFlatHeaders<TFeatures extends TableFeatures, TData extends RowData>(table: Table<TFeatures, TData>): Header<TFeatures, TData, unknown>[];
|
|
71
71
|
/**
|
|
72
72
|
* Collects only the leaf headers from the current header tree.
|
|
73
73
|
*
|
|
@@ -79,7 +79,7 @@ declare function table_getFlatHeaders<TFeatures extends TableFeatures, TData ext
|
|
|
79
79
|
* const leafHeaders = table_getLeafHeaders(table)
|
|
80
80
|
* ```
|
|
81
81
|
*/
|
|
82
|
-
declare function table_getLeafHeaders<TFeatures extends TableFeatures, TData extends RowData>(table:
|
|
82
|
+
declare function table_getLeafHeaders<TFeatures extends TableFeatures, TData extends RowData>(table: Table<TFeatures, TData>): Header<TFeatures, TData, unknown>[];
|
|
83
83
|
//#endregion
|
|
84
84
|
export { header_getContext, header_getLeafHeaders, table_getFlatHeaders, table_getFooterGroups, table_getHeaderGroups, table_getLeafHeaders };
|
|
85
85
|
//# sourceMappingURL=coreHeadersFeature.utils.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RowData } from "../../types/type-utils.cjs";
|
|
2
|
-
import {
|
|
2
|
+
import { Table } from "../../types/Table.cjs";
|
|
3
3
|
import { TableFeatures } from "../../types/TableFeatures.cjs";
|
|
4
4
|
import { RowModel } from "./coreRowModelsFeature.types.cjs";
|
|
5
5
|
|
|
@@ -15,7 +15,7 @@ import { RowModel } from "./coreRowModelsFeature.types.cjs";
|
|
|
15
15
|
* const coreRows = table_getCoreRowModel(table)
|
|
16
16
|
* ```
|
|
17
17
|
*/
|
|
18
|
-
declare function table_getCoreRowModel<TFeatures extends TableFeatures, TData extends RowData>(table:
|
|
18
|
+
declare function table_getCoreRowModel<TFeatures extends TableFeatures, TData extends RowData>(table: Table<TFeatures, TData>): RowModel<TFeatures, TData>;
|
|
19
19
|
/**
|
|
20
20
|
* Reads the row model immediately before column/global filtering.
|
|
21
21
|
*
|
|
@@ -27,7 +27,7 @@ declare function table_getCoreRowModel<TFeatures extends TableFeatures, TData ex
|
|
|
27
27
|
* const rowsBeforeFiltering = table_getPreFilteredRowModel(table)
|
|
28
28
|
* ```
|
|
29
29
|
*/
|
|
30
|
-
declare function table_getPreFilteredRowModel<TFeatures extends TableFeatures, TData extends RowData>(table:
|
|
30
|
+
declare function table_getPreFilteredRowModel<TFeatures extends TableFeatures, TData extends RowData>(table: Table<TFeatures, TData>): RowModel<TFeatures, TData>;
|
|
31
31
|
/**
|
|
32
32
|
* Resolves the row model after column and global filtering.
|
|
33
33
|
*
|
|
@@ -40,7 +40,7 @@ declare function table_getPreFilteredRowModel<TFeatures extends TableFeatures, T
|
|
|
40
40
|
* const filteredRows = table_getFilteredRowModel(table)
|
|
41
41
|
* ```
|
|
42
42
|
*/
|
|
43
|
-
declare function table_getFilteredRowModel<TFeatures extends TableFeatures, TData extends RowData>(table:
|
|
43
|
+
declare function table_getFilteredRowModel<TFeatures extends TableFeatures, TData extends RowData>(table: Table<TFeatures, TData>): RowModel<TFeatures, TData>;
|
|
44
44
|
/**
|
|
45
45
|
* Reads the row model immediately before grouping.
|
|
46
46
|
*
|
|
@@ -51,7 +51,7 @@ declare function table_getFilteredRowModel<TFeatures extends TableFeatures, TDat
|
|
|
51
51
|
* const rowsBeforeGrouping = table_getPreGroupedRowModel(table)
|
|
52
52
|
* ```
|
|
53
53
|
*/
|
|
54
|
-
declare function table_getPreGroupedRowModel<TFeatures extends TableFeatures, TData extends RowData>(table:
|
|
54
|
+
declare function table_getPreGroupedRowModel<TFeatures extends TableFeatures, TData extends RowData>(table: Table<TFeatures, TData>): RowModel<TFeatures, TData>;
|
|
55
55
|
/**
|
|
56
56
|
* Resolves the row model after grouping has produced grouped and aggregated rows.
|
|
57
57
|
*
|
|
@@ -63,7 +63,7 @@ declare function table_getPreGroupedRowModel<TFeatures extends TableFeatures, TD
|
|
|
63
63
|
* const groupedRows = table_getGroupedRowModel(table)
|
|
64
64
|
* ```
|
|
65
65
|
*/
|
|
66
|
-
declare function table_getGroupedRowModel<TFeatures extends TableFeatures, TData extends RowData>(table:
|
|
66
|
+
declare function table_getGroupedRowModel<TFeatures extends TableFeatures, TData extends RowData>(table: Table<TFeatures, TData>): RowModel<TFeatures, TData>;
|
|
67
67
|
/**
|
|
68
68
|
* Reads the row model immediately before sorting.
|
|
69
69
|
*
|
|
@@ -74,7 +74,7 @@ declare function table_getGroupedRowModel<TFeatures extends TableFeatures, TData
|
|
|
74
74
|
* const rowsBeforeSorting = table_getPreSortedRowModel(table)
|
|
75
75
|
* ```
|
|
76
76
|
*/
|
|
77
|
-
declare function table_getPreSortedRowModel<TFeatures extends TableFeatures, TData extends RowData>(table:
|
|
77
|
+
declare function table_getPreSortedRowModel<TFeatures extends TableFeatures, TData extends RowData>(table: Table<TFeatures, TData>): RowModel<TFeatures, TData>;
|
|
78
78
|
/**
|
|
79
79
|
* Resolves the row model after sorting has been applied.
|
|
80
80
|
*
|
|
@@ -87,7 +87,7 @@ declare function table_getPreSortedRowModel<TFeatures extends TableFeatures, TDa
|
|
|
87
87
|
* const sortedRows = table_getSortedRowModel(table)
|
|
88
88
|
* ```
|
|
89
89
|
*/
|
|
90
|
-
declare function table_getSortedRowModel<TFeatures extends TableFeatures, TData extends RowData>(table:
|
|
90
|
+
declare function table_getSortedRowModel<TFeatures extends TableFeatures, TData extends RowData>(table: Table<TFeatures, TData>): RowModel<TFeatures, TData>;
|
|
91
91
|
/**
|
|
92
92
|
* Reads the row model immediately before row expansion.
|
|
93
93
|
*
|
|
@@ -98,7 +98,7 @@ declare function table_getSortedRowModel<TFeatures extends TableFeatures, TData
|
|
|
98
98
|
* const rowsBeforeExpansion = table_getPreExpandedRowModel(table)
|
|
99
99
|
* ```
|
|
100
100
|
*/
|
|
101
|
-
declare function table_getPreExpandedRowModel<TFeatures extends TableFeatures, TData extends RowData>(table:
|
|
101
|
+
declare function table_getPreExpandedRowModel<TFeatures extends TableFeatures, TData extends RowData>(table: Table<TFeatures, TData>): RowModel<TFeatures, TData>;
|
|
102
102
|
/**
|
|
103
103
|
* Resolves the row model after expanded rows have been flattened into view.
|
|
104
104
|
*
|
|
@@ -110,7 +110,7 @@ declare function table_getPreExpandedRowModel<TFeatures extends TableFeatures, T
|
|
|
110
110
|
* const expandedRows = table_getExpandedRowModel(table)
|
|
111
111
|
* ```
|
|
112
112
|
*/
|
|
113
|
-
declare function table_getExpandedRowModel<TFeatures extends TableFeatures, TData extends RowData>(table:
|
|
113
|
+
declare function table_getExpandedRowModel<TFeatures extends TableFeatures, TData extends RowData>(table: Table<TFeatures, TData>): RowModel<TFeatures, TData>;
|
|
114
114
|
/**
|
|
115
115
|
* Reads the row model immediately before pagination.
|
|
116
116
|
*
|
|
@@ -122,7 +122,7 @@ declare function table_getExpandedRowModel<TFeatures extends TableFeatures, TDat
|
|
|
122
122
|
* const rowsBeforePagination = table_getPrePaginatedRowModel(table)
|
|
123
123
|
* ```
|
|
124
124
|
*/
|
|
125
|
-
declare function table_getPrePaginatedRowModel<TFeatures extends TableFeatures, TData extends RowData>(table:
|
|
125
|
+
declare function table_getPrePaginatedRowModel<TFeatures extends TableFeatures, TData extends RowData>(table: Table<TFeatures, TData>): RowModel<TFeatures, TData>;
|
|
126
126
|
/**
|
|
127
127
|
* Resolves the row model after pagination has sliced rows for the current page.
|
|
128
128
|
*
|
|
@@ -135,7 +135,7 @@ declare function table_getPrePaginatedRowModel<TFeatures extends TableFeatures,
|
|
|
135
135
|
* const pageRows = table_getPaginatedRowModel(table)
|
|
136
136
|
* ```
|
|
137
137
|
*/
|
|
138
|
-
declare function table_getPaginatedRowModel<TFeatures extends TableFeatures, TData extends RowData>(table:
|
|
138
|
+
declare function table_getPaginatedRowModel<TFeatures extends TableFeatures, TData extends RowData>(table: Table<TFeatures, TData>): RowModel<TFeatures, TData>;
|
|
139
139
|
/**
|
|
140
140
|
* Resolves the final row model consumed by renderers.
|
|
141
141
|
*
|
|
@@ -147,7 +147,7 @@ declare function table_getPaginatedRowModel<TFeatures extends TableFeatures, TDa
|
|
|
147
147
|
* const visibleRows = table_getRowModel(table)
|
|
148
148
|
* ```
|
|
149
149
|
*/
|
|
150
|
-
declare function table_getRowModel<TFeatures extends TableFeatures, TData extends RowData>(table:
|
|
150
|
+
declare function table_getRowModel<TFeatures extends TableFeatures, TData extends RowData>(table: Table<TFeatures, TData>): RowModel<TFeatures, TData>;
|
|
151
151
|
//#endregion
|
|
152
152
|
export { table_getCoreRowModel, table_getExpandedRowModel, table_getFilteredRowModel, table_getGroupedRowModel, table_getPaginatedRowModel, table_getPreExpandedRowModel, table_getPreFilteredRowModel, table_getPreGroupedRowModel, table_getPrePaginatedRowModel, table_getPreSortedRowModel, table_getRowModel, table_getSortedRowModel };
|
|
153
153
|
//# sourceMappingURL=coreRowModelsFeature.utils.d.cts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RowData } from "../../types/type-utils.js";
|
|
2
|
-
import {
|
|
2
|
+
import { Table } from "../../types/Table.js";
|
|
3
3
|
import { TableFeatures } from "../../types/TableFeatures.js";
|
|
4
4
|
import { RowModel } from "./coreRowModelsFeature.types.js";
|
|
5
5
|
|
|
@@ -15,7 +15,7 @@ import { RowModel } from "./coreRowModelsFeature.types.js";
|
|
|
15
15
|
* const coreRows = table_getCoreRowModel(table)
|
|
16
16
|
* ```
|
|
17
17
|
*/
|
|
18
|
-
declare function table_getCoreRowModel<TFeatures extends TableFeatures, TData extends RowData>(table:
|
|
18
|
+
declare function table_getCoreRowModel<TFeatures extends TableFeatures, TData extends RowData>(table: Table<TFeatures, TData>): RowModel<TFeatures, TData>;
|
|
19
19
|
/**
|
|
20
20
|
* Reads the row model immediately before column/global filtering.
|
|
21
21
|
*
|
|
@@ -27,7 +27,7 @@ declare function table_getCoreRowModel<TFeatures extends TableFeatures, TData ex
|
|
|
27
27
|
* const rowsBeforeFiltering = table_getPreFilteredRowModel(table)
|
|
28
28
|
* ```
|
|
29
29
|
*/
|
|
30
|
-
declare function table_getPreFilteredRowModel<TFeatures extends TableFeatures, TData extends RowData>(table:
|
|
30
|
+
declare function table_getPreFilteredRowModel<TFeatures extends TableFeatures, TData extends RowData>(table: Table<TFeatures, TData>): RowModel<TFeatures, TData>;
|
|
31
31
|
/**
|
|
32
32
|
* Resolves the row model after column and global filtering.
|
|
33
33
|
*
|
|
@@ -40,7 +40,7 @@ declare function table_getPreFilteredRowModel<TFeatures extends TableFeatures, T
|
|
|
40
40
|
* const filteredRows = table_getFilteredRowModel(table)
|
|
41
41
|
* ```
|
|
42
42
|
*/
|
|
43
|
-
declare function table_getFilteredRowModel<TFeatures extends TableFeatures, TData extends RowData>(table:
|
|
43
|
+
declare function table_getFilteredRowModel<TFeatures extends TableFeatures, TData extends RowData>(table: Table<TFeatures, TData>): RowModel<TFeatures, TData>;
|
|
44
44
|
/**
|
|
45
45
|
* Reads the row model immediately before grouping.
|
|
46
46
|
*
|
|
@@ -51,7 +51,7 @@ declare function table_getFilteredRowModel<TFeatures extends TableFeatures, TDat
|
|
|
51
51
|
* const rowsBeforeGrouping = table_getPreGroupedRowModel(table)
|
|
52
52
|
* ```
|
|
53
53
|
*/
|
|
54
|
-
declare function table_getPreGroupedRowModel<TFeatures extends TableFeatures, TData extends RowData>(table:
|
|
54
|
+
declare function table_getPreGroupedRowModel<TFeatures extends TableFeatures, TData extends RowData>(table: Table<TFeatures, TData>): RowModel<TFeatures, TData>;
|
|
55
55
|
/**
|
|
56
56
|
* Resolves the row model after grouping has produced grouped and aggregated rows.
|
|
57
57
|
*
|
|
@@ -63,7 +63,7 @@ declare function table_getPreGroupedRowModel<TFeatures extends TableFeatures, TD
|
|
|
63
63
|
* const groupedRows = table_getGroupedRowModel(table)
|
|
64
64
|
* ```
|
|
65
65
|
*/
|
|
66
|
-
declare function table_getGroupedRowModel<TFeatures extends TableFeatures, TData extends RowData>(table:
|
|
66
|
+
declare function table_getGroupedRowModel<TFeatures extends TableFeatures, TData extends RowData>(table: Table<TFeatures, TData>): RowModel<TFeatures, TData>;
|
|
67
67
|
/**
|
|
68
68
|
* Reads the row model immediately before sorting.
|
|
69
69
|
*
|
|
@@ -74,7 +74,7 @@ declare function table_getGroupedRowModel<TFeatures extends TableFeatures, TData
|
|
|
74
74
|
* const rowsBeforeSorting = table_getPreSortedRowModel(table)
|
|
75
75
|
* ```
|
|
76
76
|
*/
|
|
77
|
-
declare function table_getPreSortedRowModel<TFeatures extends TableFeatures, TData extends RowData>(table:
|
|
77
|
+
declare function table_getPreSortedRowModel<TFeatures extends TableFeatures, TData extends RowData>(table: Table<TFeatures, TData>): RowModel<TFeatures, TData>;
|
|
78
78
|
/**
|
|
79
79
|
* Resolves the row model after sorting has been applied.
|
|
80
80
|
*
|
|
@@ -87,7 +87,7 @@ declare function table_getPreSortedRowModel<TFeatures extends TableFeatures, TDa
|
|
|
87
87
|
* const sortedRows = table_getSortedRowModel(table)
|
|
88
88
|
* ```
|
|
89
89
|
*/
|
|
90
|
-
declare function table_getSortedRowModel<TFeatures extends TableFeatures, TData extends RowData>(table:
|
|
90
|
+
declare function table_getSortedRowModel<TFeatures extends TableFeatures, TData extends RowData>(table: Table<TFeatures, TData>): RowModel<TFeatures, TData>;
|
|
91
91
|
/**
|
|
92
92
|
* Reads the row model immediately before row expansion.
|
|
93
93
|
*
|
|
@@ -98,7 +98,7 @@ declare function table_getSortedRowModel<TFeatures extends TableFeatures, TData
|
|
|
98
98
|
* const rowsBeforeExpansion = table_getPreExpandedRowModel(table)
|
|
99
99
|
* ```
|
|
100
100
|
*/
|
|
101
|
-
declare function table_getPreExpandedRowModel<TFeatures extends TableFeatures, TData extends RowData>(table:
|
|
101
|
+
declare function table_getPreExpandedRowModel<TFeatures extends TableFeatures, TData extends RowData>(table: Table<TFeatures, TData>): RowModel<TFeatures, TData>;
|
|
102
102
|
/**
|
|
103
103
|
* Resolves the row model after expanded rows have been flattened into view.
|
|
104
104
|
*
|
|
@@ -110,7 +110,7 @@ declare function table_getPreExpandedRowModel<TFeatures extends TableFeatures, T
|
|
|
110
110
|
* const expandedRows = table_getExpandedRowModel(table)
|
|
111
111
|
* ```
|
|
112
112
|
*/
|
|
113
|
-
declare function table_getExpandedRowModel<TFeatures extends TableFeatures, TData extends RowData>(table:
|
|
113
|
+
declare function table_getExpandedRowModel<TFeatures extends TableFeatures, TData extends RowData>(table: Table<TFeatures, TData>): RowModel<TFeatures, TData>;
|
|
114
114
|
/**
|
|
115
115
|
* Reads the row model immediately before pagination.
|
|
116
116
|
*
|
|
@@ -122,7 +122,7 @@ declare function table_getExpandedRowModel<TFeatures extends TableFeatures, TDat
|
|
|
122
122
|
* const rowsBeforePagination = table_getPrePaginatedRowModel(table)
|
|
123
123
|
* ```
|
|
124
124
|
*/
|
|
125
|
-
declare function table_getPrePaginatedRowModel<TFeatures extends TableFeatures, TData extends RowData>(table:
|
|
125
|
+
declare function table_getPrePaginatedRowModel<TFeatures extends TableFeatures, TData extends RowData>(table: Table<TFeatures, TData>): RowModel<TFeatures, TData>;
|
|
126
126
|
/**
|
|
127
127
|
* Resolves the row model after pagination has sliced rows for the current page.
|
|
128
128
|
*
|
|
@@ -135,7 +135,7 @@ declare function table_getPrePaginatedRowModel<TFeatures extends TableFeatures,
|
|
|
135
135
|
* const pageRows = table_getPaginatedRowModel(table)
|
|
136
136
|
* ```
|
|
137
137
|
*/
|
|
138
|
-
declare function table_getPaginatedRowModel<TFeatures extends TableFeatures, TData extends RowData>(table:
|
|
138
|
+
declare function table_getPaginatedRowModel<TFeatures extends TableFeatures, TData extends RowData>(table: Table<TFeatures, TData>): RowModel<TFeatures, TData>;
|
|
139
139
|
/**
|
|
140
140
|
* Resolves the final row model consumed by renderers.
|
|
141
141
|
*
|
|
@@ -147,7 +147,7 @@ declare function table_getPaginatedRowModel<TFeatures extends TableFeatures, TDa
|
|
|
147
147
|
* const visibleRows = table_getRowModel(table)
|
|
148
148
|
* ```
|
|
149
149
|
*/
|
|
150
|
-
declare function table_getRowModel<TFeatures extends TableFeatures, TData extends RowData>(table:
|
|
150
|
+
declare function table_getRowModel<TFeatures extends TableFeatures, TData extends RowData>(table: Table<TFeatures, TData>): RowModel<TFeatures, TData>;
|
|
151
151
|
//#endregion
|
|
152
152
|
export { table_getCoreRowModel, table_getExpandedRowModel, table_getFilteredRowModel, table_getGroupedRowModel, table_getPaginatedRowModel, table_getPreExpandedRowModel, table_getPreFilteredRowModel, table_getPreGroupedRowModel, table_getPrePaginatedRowModel, table_getPreSortedRowModel, table_getRowModel, table_getSortedRowModel };
|
|
153
153
|
//# sourceMappingURL=coreRowModelsFeature.utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createCoreRowModel.cjs","names":["tableMemo","table_autoResetPageIndex","constructRow"],"sources":["../../../src/core/row-models/createCoreRowModel.ts"],"sourcesContent":["import { constructRow } from '../rows/constructRow'\nimport { tableMemo } from '../../utils'\nimport { table_autoResetPageIndex } from '../../features/row-pagination/rowPaginationFeature.utils'\nimport type { Table_Internal } from '../../types/Table'\nimport type { RowModel } from './coreRowModelsFeature.types'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { Row } from '../../types/Row'\nimport type { RowData } from '../../types/type-utils'\n\n/**\n * Creates a memoized core row model factory.\n *\n * The factory reads the relevant table state atoms and options, then returns a row model function used by the table row-model pipeline.\n */\nexport function createCoreRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(): (\n table: Table_Internal<TFeatures, TData>,\n) => () => RowModel<TFeatures, TData> {\n return (table) => {\n return tableMemo({\n feature: 'coreRowModelsFeature',\n table,\n fnName: 'table.getCoreRowModel',\n memoDeps: () => [table.options.data],\n fn: () => _createCoreRowModel(table, table.options.data),\n onAfterUpdate: () => table_autoResetPageIndex(table),\n })\n }\n}\n\nfunction _createCoreRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n data: ReadonlyArray<TData>,\n): {\n rows: Array<Row<TFeatures, TData>>\n flatRows: Array<Row<TFeatures, TData>>\n rowsById: Record<string, Row<TFeatures, TData>>\n} {\n const rowModel: RowModel<TFeatures, TData> = {\n rows: [],\n flatRows: [],\n rowsById:
|
|
1
|
+
{"version":3,"file":"createCoreRowModel.cjs","names":["tableMemo","table_autoResetPageIndex","makeObjectMap","constructRow"],"sources":["../../../src/core/row-models/createCoreRowModel.ts"],"sourcesContent":["import { constructRow } from '../rows/constructRow'\nimport { makeObjectMap, tableMemo } from '../../utils'\nimport { table_autoResetPageIndex } from '../../features/row-pagination/rowPaginationFeature.utils'\nimport type { Table_Internal } from '../../types/Table'\nimport type { RowModel } from './coreRowModelsFeature.types'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { Row } from '../../types/Row'\nimport type { RowData } from '../../types/type-utils'\n\n/**\n * Creates a memoized core row model factory.\n *\n * The factory reads the relevant table state atoms and options, then returns a row model function used by the table row-model pipeline.\n */\nexport function createCoreRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(): (\n table: Table_Internal<TFeatures, TData>,\n) => () => RowModel<TFeatures, TData> {\n return (table) => {\n return tableMemo({\n feature: 'coreRowModelsFeature',\n table,\n fnName: 'table.getCoreRowModel',\n memoDeps: () => [table.options.data],\n fn: () => _createCoreRowModel(table, table.options.data),\n onAfterUpdate: () => table_autoResetPageIndex(table),\n })\n }\n}\n\nfunction _createCoreRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n data: ReadonlyArray<TData>,\n): {\n rows: Array<Row<TFeatures, TData>>\n flatRows: Array<Row<TFeatures, TData>>\n rowsById: Record<string, Row<TFeatures, TData>>\n} {\n const rowModel: RowModel<TFeatures, TData> = {\n rows: [],\n flatRows: [],\n rowsById: makeObjectMap(),\n }\n\n const accessRows = (\n originalRows: ReadonlyArray<TData>,\n depth = 0,\n parentRow?: Row<TFeatures, TData>,\n ): Array<Row<TFeatures, TData>> => {\n const rows = [] as Array<Row<TFeatures, TData>>\n\n for (let i = 0; i < originalRows.length; i++) {\n const originalRow = originalRows[i]!\n // Make the row\n const row = constructRow(\n table,\n table.getRowId(originalRow, i, parentRow),\n originalRow,\n i,\n depth,\n undefined,\n parentRow?.id,\n )\n\n // Keep track of every row in a flat array\n rowModel.flatRows.push(row)\n // Also keep track of every row by its ID\n rowModel.rowsById[row.id] = row\n // Push table row into parent\n rows.push(row)\n\n // Get the original subrows\n if (table.options.getSubRows) {\n row.originalSubRows = table.options.getSubRows(originalRow, i)\n\n // Then recursively access them\n if (row.originalSubRows?.length) {\n row.subRows = accessRows(row.originalSubRows, depth + 1, row)\n }\n }\n }\n\n return rows\n }\n\n rowModel.rows = accessRows(data)\n\n return rowModel\n}\n"],"mappings":";;;;;;;;;;AAcA,SAAgB,qBAKsB;CACpC,QAAQ,UAAU;EAChB,OAAOA,wBAAU;GACf,SAAS;GACT;GACA,QAAQ;GACR,gBAAgB,CAAC,MAAM,QAAQ,IAAI;GACnC,UAAU,oBAAoB,OAAO,MAAM,QAAQ,IAAI;GACvD,qBAAqBC,4DAAyB,KAAK;EACrD,CAAC;CACH;AACF;AAEA,SAAS,oBAIP,OACA,MAKA;CACA,MAAM,WAAuC;EAC3C,MAAM,CAAC;EACP,UAAU,CAAC;EACX,UAAUC,4BAAc;CAC1B;CAEA,MAAM,cACJ,cACA,QAAQ,GACR,cACiC;EACjC,MAAM,OAAO,CAAC;EAEd,KAAK,IAAI,IAAI,GAAG,IAAI,aAAa,QAAQ,KAAK;GAC5C,MAAM,cAAc,aAAa;GAEjC,MAAM,MAAMC,kCACV,OACA,MAAM,SAAS,aAAa,GAAG,SAAS,GACxC,aACA,GACA,OACA,8DACA,UAAW,EACb;GAGA,SAAS,SAAS,KAAK,GAAG;GAE1B,SAAS,SAAS,IAAI,MAAM;GAE5B,KAAK,KAAK,GAAG;GAGb,IAAI,MAAM,QAAQ,YAAY;;IAC5B,IAAI,kBAAkB,MAAM,QAAQ,WAAW,aAAa,CAAC;IAG7D,4BAAI,IAAI,6FAAiB,QACvB,IAAI,UAAU,WAAW,IAAI,iBAAiB,QAAQ,GAAG,GAAG;GAEhE;EACF;EAEA,OAAO;CACT;CAEA,SAAS,OAAO,WAAW,IAAI;CAE/B,OAAO;AACT"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RowData } from "../../types/type-utils.cjs";
|
|
2
|
-
import {
|
|
2
|
+
import { Table } from "../../types/Table.cjs";
|
|
3
3
|
import { TableFeatures } from "../../types/TableFeatures.cjs";
|
|
4
4
|
import { RowModel } from "./coreRowModelsFeature.types.cjs";
|
|
5
5
|
|
|
@@ -9,7 +9,7 @@ import { RowModel } from "./coreRowModelsFeature.types.cjs";
|
|
|
9
9
|
*
|
|
10
10
|
* The factory reads the relevant table state atoms and options, then returns a row model function used by the table row-model pipeline.
|
|
11
11
|
*/
|
|
12
|
-
declare function createCoreRowModel<TFeatures extends TableFeatures, TData extends RowData>(): (table:
|
|
12
|
+
declare function createCoreRowModel<TFeatures extends TableFeatures, TData extends RowData>(): (table: Table<TFeatures, TData>) => () => RowModel<TFeatures, TData>;
|
|
13
13
|
//#endregion
|
|
14
14
|
export { createCoreRowModel };
|
|
15
15
|
//# sourceMappingURL=createCoreRowModel.d.cts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RowData } from "../../types/type-utils.js";
|
|
2
|
-
import {
|
|
2
|
+
import { Table } from "../../types/Table.js";
|
|
3
3
|
import { TableFeatures } from "../../types/TableFeatures.js";
|
|
4
4
|
import { RowModel } from "./coreRowModelsFeature.types.js";
|
|
5
5
|
|
|
@@ -9,7 +9,7 @@ import { RowModel } from "./coreRowModelsFeature.types.js";
|
|
|
9
9
|
*
|
|
10
10
|
* The factory reads the relevant table state atoms and options, then returns a row model function used by the table row-model pipeline.
|
|
11
11
|
*/
|
|
12
|
-
declare function createCoreRowModel<TFeatures extends TableFeatures, TData extends RowData>(): (table:
|
|
12
|
+
declare function createCoreRowModel<TFeatures extends TableFeatures, TData extends RowData>(): (table: Table<TFeatures, TData>) => () => RowModel<TFeatures, TData>;
|
|
13
13
|
//#endregion
|
|
14
14
|
export { createCoreRowModel };
|
|
15
15
|
//# sourceMappingURL=createCoreRowModel.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { tableMemo } from "../../utils.js";
|
|
1
|
+
import { makeObjectMap, tableMemo } from "../../utils.js";
|
|
2
2
|
import { constructRow } from "../rows/constructRow.js";
|
|
3
3
|
import { table_autoResetPageIndex } from "../../features/row-pagination/rowPaginationFeature.utils.js";
|
|
4
4
|
|
|
@@ -24,7 +24,7 @@ function _createCoreRowModel(table, data) {
|
|
|
24
24
|
const rowModel = {
|
|
25
25
|
rows: [],
|
|
26
26
|
flatRows: [],
|
|
27
|
-
rowsById:
|
|
27
|
+
rowsById: makeObjectMap()
|
|
28
28
|
};
|
|
29
29
|
const accessRows = (originalRows, depth = 0, parentRow) => {
|
|
30
30
|
const rows = [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createCoreRowModel.js","names":[],"sources":["../../../src/core/row-models/createCoreRowModel.ts"],"sourcesContent":["import { constructRow } from '../rows/constructRow'\nimport { tableMemo } from '../../utils'\nimport { table_autoResetPageIndex } from '../../features/row-pagination/rowPaginationFeature.utils'\nimport type { Table_Internal } from '../../types/Table'\nimport type { RowModel } from './coreRowModelsFeature.types'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { Row } from '../../types/Row'\nimport type { RowData } from '../../types/type-utils'\n\n/**\n * Creates a memoized core row model factory.\n *\n * The factory reads the relevant table state atoms and options, then returns a row model function used by the table row-model pipeline.\n */\nexport function createCoreRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(): (\n table: Table_Internal<TFeatures, TData>,\n) => () => RowModel<TFeatures, TData> {\n return (table) => {\n return tableMemo({\n feature: 'coreRowModelsFeature',\n table,\n fnName: 'table.getCoreRowModel',\n memoDeps: () => [table.options.data],\n fn: () => _createCoreRowModel(table, table.options.data),\n onAfterUpdate: () => table_autoResetPageIndex(table),\n })\n }\n}\n\nfunction _createCoreRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n data: ReadonlyArray<TData>,\n): {\n rows: Array<Row<TFeatures, TData>>\n flatRows: Array<Row<TFeatures, TData>>\n rowsById: Record<string, Row<TFeatures, TData>>\n} {\n const rowModel: RowModel<TFeatures, TData> = {\n rows: [],\n flatRows: [],\n rowsById:
|
|
1
|
+
{"version":3,"file":"createCoreRowModel.js","names":[],"sources":["../../../src/core/row-models/createCoreRowModel.ts"],"sourcesContent":["import { constructRow } from '../rows/constructRow'\nimport { makeObjectMap, tableMemo } from '../../utils'\nimport { table_autoResetPageIndex } from '../../features/row-pagination/rowPaginationFeature.utils'\nimport type { Table_Internal } from '../../types/Table'\nimport type { RowModel } from './coreRowModelsFeature.types'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { Row } from '../../types/Row'\nimport type { RowData } from '../../types/type-utils'\n\n/**\n * Creates a memoized core row model factory.\n *\n * The factory reads the relevant table state atoms and options, then returns a row model function used by the table row-model pipeline.\n */\nexport function createCoreRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(): (\n table: Table_Internal<TFeatures, TData>,\n) => () => RowModel<TFeatures, TData> {\n return (table) => {\n return tableMemo({\n feature: 'coreRowModelsFeature',\n table,\n fnName: 'table.getCoreRowModel',\n memoDeps: () => [table.options.data],\n fn: () => _createCoreRowModel(table, table.options.data),\n onAfterUpdate: () => table_autoResetPageIndex(table),\n })\n }\n}\n\nfunction _createCoreRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n data: ReadonlyArray<TData>,\n): {\n rows: Array<Row<TFeatures, TData>>\n flatRows: Array<Row<TFeatures, TData>>\n rowsById: Record<string, Row<TFeatures, TData>>\n} {\n const rowModel: RowModel<TFeatures, TData> = {\n rows: [],\n flatRows: [],\n rowsById: makeObjectMap(),\n }\n\n const accessRows = (\n originalRows: ReadonlyArray<TData>,\n depth = 0,\n parentRow?: Row<TFeatures, TData>,\n ): Array<Row<TFeatures, TData>> => {\n const rows = [] as Array<Row<TFeatures, TData>>\n\n for (let i = 0; i < originalRows.length; i++) {\n const originalRow = originalRows[i]!\n // Make the row\n const row = constructRow(\n table,\n table.getRowId(originalRow, i, parentRow),\n originalRow,\n i,\n depth,\n undefined,\n parentRow?.id,\n )\n\n // Keep track of every row in a flat array\n rowModel.flatRows.push(row)\n // Also keep track of every row by its ID\n rowModel.rowsById[row.id] = row\n // Push table row into parent\n rows.push(row)\n\n // Get the original subrows\n if (table.options.getSubRows) {\n row.originalSubRows = table.options.getSubRows(originalRow, i)\n\n // Then recursively access them\n if (row.originalSubRows?.length) {\n row.subRows = accessRows(row.originalSubRows, depth + 1, row)\n }\n }\n }\n\n return rows\n }\n\n rowModel.rows = accessRows(data)\n\n return rowModel\n}\n"],"mappings":";;;;;;;;;;AAcA,SAAgB,qBAKsB;CACpC,QAAQ,UAAU;EAChB,OAAO,UAAU;GACf,SAAS;GACT;GACA,QAAQ;GACR,gBAAgB,CAAC,MAAM,QAAQ,IAAI;GACnC,UAAU,oBAAoB,OAAO,MAAM,QAAQ,IAAI;GACvD,qBAAqB,yBAAyB,KAAK;EACrD,CAAC;CACH;AACF;AAEA,SAAS,oBAIP,OACA,MAKA;CACA,MAAM,WAAuC;EAC3C,MAAM,CAAC;EACP,UAAU,CAAC;EACX,UAAU,cAAc;CAC1B;CAEA,MAAM,cACJ,cACA,QAAQ,GACR,cACiC;EACjC,MAAM,OAAO,CAAC;EAEd,KAAK,IAAI,IAAI,GAAG,IAAI,aAAa,QAAQ,KAAK;GAC5C,MAAM,cAAc,aAAa;GAEjC,MAAM,MAAM,aACV,OACA,MAAM,SAAS,aAAa,GAAG,SAAS,GACxC,aACA,GACA,OACA,8DACA,UAAW,EACb;GAGA,SAAS,SAAS,KAAK,GAAG;GAE1B,SAAS,SAAS,IAAI,MAAM;GAE5B,KAAK,KAAK,GAAG;GAGb,IAAI,MAAM,QAAQ,YAAY;;IAC5B,IAAI,kBAAkB,MAAM,QAAQ,WAAW,aAAa,CAAC;IAG7D,4BAAI,IAAI,6FAAiB,QACvB,IAAI,UAAU,WAAW,IAAI,iBAAiB,QAAQ,GAAG,GAAG;GAEhE;EACF;EAEA,OAAO;CACT;CAEA,SAAS,OAAO,WAAW,IAAI;CAE/B,OAAO;AACT"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
const require_utils = require('../../utils.cjs');
|
|
1
2
|
|
|
2
3
|
//#region src/core/rows/constructRow.ts
|
|
3
4
|
/**
|
|
@@ -23,8 +24,8 @@ function getRowPrototype(table) {
|
|
|
23
24
|
const constructRow = (table, id, original, rowIndex, depth, subRows, parentId) => {
|
|
24
25
|
const rowPrototype = getRowPrototype(table);
|
|
25
26
|
const row = Object.create(rowPrototype);
|
|
26
|
-
row._uniqueValuesCache =
|
|
27
|
-
row._valuesCache =
|
|
27
|
+
row._uniqueValuesCache = require_utils.makeObjectMap();
|
|
28
|
+
row._valuesCache = require_utils.makeObjectMap();
|
|
28
29
|
row.depth = depth;
|
|
29
30
|
row.id = id;
|
|
30
31
|
row.index = rowIndex;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constructRow.cjs","names":[],"sources":["../../../src/core/rows/constructRow.ts"],"sourcesContent":["import type { Table_Internal } from '../../types/Table'\nimport type { RowData } from '../../types/type-utils'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { Row } from '../../types/Row'\nimport type { Row_CoreProperties } from './coreRowsFeature.types'\n\n/**\n * Creates or retrieves the row prototype for a table.\n * The prototype is cached on the table and shared by all row instances.\n */\nfunction getRowPrototype<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): object {\n if (!table._rowPrototype) {\n table._rowPrototype = { table }\n const features = Object.values(table._features)\n for (let i = 0; i < features.length; i++) {\n features[i]!.assignRowPrototype?.(table._rowPrototype, table)\n }\n }\n return table._rowPrototype\n}\n\n/**\n * Constructs a row instance from normalized table internals.\n *\n * This wires core properties, feature prototype APIs, and instance data used by table rendering and row-model operations.\n */\nexport const constructRow = <\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n id: string,\n original: TData,\n rowIndex: number,\n depth: number,\n subRows?: Array<Row<TFeatures, TData>>,\n parentId?: string,\n): Row<TFeatures, TData> => {\n // Create row with shared prototype for memory efficiency\n const rowPrototype = getRowPrototype(table)\n const row = Object.create(rowPrototype) as Row_CoreProperties<\n TFeatures,\n TData\n >\n\n // Only assign instance-specific properties\n row._uniqueValuesCache =
|
|
1
|
+
{"version":3,"file":"constructRow.cjs","names":["makeObjectMap"],"sources":["../../../src/core/rows/constructRow.ts"],"sourcesContent":["import { makeObjectMap } from '../../utils'\nimport type { Table_Internal } from '../../types/Table'\nimport type { RowData } from '../../types/type-utils'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { Row } from '../../types/Row'\nimport type { Row_CoreProperties } from './coreRowsFeature.types'\n\n/**\n * Creates or retrieves the row prototype for a table.\n * The prototype is cached on the table and shared by all row instances.\n */\nfunction getRowPrototype<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): object {\n if (!table._rowPrototype) {\n table._rowPrototype = { table }\n const features = Object.values(table._features)\n for (let i = 0; i < features.length; i++) {\n features[i]!.assignRowPrototype?.(table._rowPrototype, table)\n }\n }\n return table._rowPrototype\n}\n\n/**\n * Constructs a row instance from normalized table internals.\n *\n * This wires core properties, feature prototype APIs, and instance data used by table rendering and row-model operations.\n */\nexport const constructRow = <\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n id: string,\n original: TData,\n rowIndex: number,\n depth: number,\n subRows?: Array<Row<TFeatures, TData>>,\n parentId?: string,\n): Row<TFeatures, TData> => {\n // Create row with shared prototype for memory efficiency\n const rowPrototype = getRowPrototype(table)\n const row = Object.create(rowPrototype) as Row_CoreProperties<\n TFeatures,\n TData\n >\n\n // Only assign instance-specific properties\n row._uniqueValuesCache = makeObjectMap()\n row._valuesCache = makeObjectMap()\n row.depth = depth\n row.id = id\n row.index = rowIndex\n row.original = original\n row.parentId = parentId\n row.subRows = subRows ?? []\n\n // Initialize instance-specific data (e.g., caches) for features that need it\n const features = Object.values(table._features)\n for (let i = 0; i < features.length; i++) {\n features[i]!.initRowInstanceData?.(row)\n }\n\n return row as Row<TFeatures, TData>\n}\n"],"mappings":";;;;;;;AAWA,SAAS,gBAGP,OAAiD;CACjD,IAAI,CAAC,MAAM,eAAe;EACxB,MAAM,gBAAgB,EAAE,MAAM;EAC9B,MAAM,WAAW,OAAO,OAAO,MAAM,SAAS;EAC9C,KAAK,IAAI,IAAI,GAAG,IAAI,SAAS,QAAQ,KAAK;;GACxC,wCAAS,IAAI,iGAAqB,MAAM,eAAe,KAAK;EAC9D;CACF;CACA,OAAO,MAAM;AACf;;;;;;AAOA,MAAa,gBAIX,OACA,IACA,UACA,UACA,OACA,SACA,aAC0B;CAE1B,MAAM,eAAe,gBAAgB,KAAK;CAC1C,MAAM,MAAM,OAAO,OAAO,YAAY;CAMtC,IAAI,qBAAqBA,4BAAc;CACvC,IAAI,eAAeA,4BAAc;CACjC,IAAI,QAAQ;CACZ,IAAI,KAAK;CACT,IAAI,QAAQ;CACZ,IAAI,WAAW;CACf,IAAI,WAAW;CACf,IAAI,UAAU,WAAW,CAAC;CAG1B,MAAM,WAAW,OAAO,OAAO,MAAM,SAAS;CAC9C,KAAK,IAAI,IAAI,GAAG,IAAI,SAAS,QAAQ,KAAK;;EACxC,0CAAS,IAAI,qGAAsB,GAAG;CACxC;CAEA,OAAO;AACT"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RowData } from "../../types/type-utils.cjs";
|
|
2
2
|
import { Row } from "../../types/Row.cjs";
|
|
3
|
-
import {
|
|
3
|
+
import { Table } from "../../types/Table.cjs";
|
|
4
4
|
import { TableFeatures } from "../../types/TableFeatures.cjs";
|
|
5
5
|
|
|
6
6
|
//#region src/core/rows/constructRow.d.ts
|
|
@@ -9,7 +9,7 @@ import { TableFeatures } from "../../types/TableFeatures.cjs";
|
|
|
9
9
|
*
|
|
10
10
|
* This wires core properties, feature prototype APIs, and instance data used by table rendering and row-model operations.
|
|
11
11
|
*/
|
|
12
|
-
declare const constructRow: <TFeatures extends TableFeatures, TData extends RowData>(table:
|
|
12
|
+
declare const constructRow: <TFeatures extends TableFeatures, TData extends RowData>(table: Table<TFeatures, TData>, id: string, original: TData, rowIndex: number, depth: number, subRows?: Array<Row<TFeatures, TData>>, parentId?: string) => Row<TFeatures, TData>;
|
|
13
13
|
//#endregion
|
|
14
14
|
export { constructRow };
|
|
15
15
|
//# sourceMappingURL=constructRow.d.cts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RowData } from "../../types/type-utils.js";
|
|
2
2
|
import { Row } from "../../types/Row.js";
|
|
3
|
-
import {
|
|
3
|
+
import { Table } from "../../types/Table.js";
|
|
4
4
|
import { TableFeatures } from "../../types/TableFeatures.js";
|
|
5
5
|
|
|
6
6
|
//#region src/core/rows/constructRow.d.ts
|
|
@@ -9,7 +9,7 @@ import { TableFeatures } from "../../types/TableFeatures.js";
|
|
|
9
9
|
*
|
|
10
10
|
* This wires core properties, feature prototype APIs, and instance data used by table rendering and row-model operations.
|
|
11
11
|
*/
|
|
12
|
-
declare const constructRow: <TFeatures extends TableFeatures, TData extends RowData>(table:
|
|
12
|
+
declare const constructRow: <TFeatures extends TableFeatures, TData extends RowData>(table: Table<TFeatures, TData>, id: string, original: TData, rowIndex: number, depth: number, subRows?: Array<Row<TFeatures, TData>>, parentId?: string) => Row<TFeatures, TData>;
|
|
13
13
|
//#endregion
|
|
14
14
|
export { constructRow };
|
|
15
15
|
//# sourceMappingURL=constructRow.d.ts.map
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { makeObjectMap } from "../../utils.js";
|
|
2
|
+
|
|
1
3
|
//#region src/core/rows/constructRow.ts
|
|
2
4
|
/**
|
|
3
5
|
* Creates or retrieves the row prototype for a table.
|
|
@@ -22,8 +24,8 @@ function getRowPrototype(table) {
|
|
|
22
24
|
const constructRow = (table, id, original, rowIndex, depth, subRows, parentId) => {
|
|
23
25
|
const rowPrototype = getRowPrototype(table);
|
|
24
26
|
const row = Object.create(rowPrototype);
|
|
25
|
-
row._uniqueValuesCache =
|
|
26
|
-
row._valuesCache =
|
|
27
|
+
row._uniqueValuesCache = makeObjectMap();
|
|
28
|
+
row._valuesCache = makeObjectMap();
|
|
27
29
|
row.depth = depth;
|
|
28
30
|
row.id = id;
|
|
29
31
|
row.index = rowIndex;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constructRow.js","names":[],"sources":["../../../src/core/rows/constructRow.ts"],"sourcesContent":["import type { Table_Internal } from '../../types/Table'\nimport type { RowData } from '../../types/type-utils'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { Row } from '../../types/Row'\nimport type { Row_CoreProperties } from './coreRowsFeature.types'\n\n/**\n * Creates or retrieves the row prototype for a table.\n * The prototype is cached on the table and shared by all row instances.\n */\nfunction getRowPrototype<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): object {\n if (!table._rowPrototype) {\n table._rowPrototype = { table }\n const features = Object.values(table._features)\n for (let i = 0; i < features.length; i++) {\n features[i]!.assignRowPrototype?.(table._rowPrototype, table)\n }\n }\n return table._rowPrototype\n}\n\n/**\n * Constructs a row instance from normalized table internals.\n *\n * This wires core properties, feature prototype APIs, and instance data used by table rendering and row-model operations.\n */\nexport const constructRow = <\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n id: string,\n original: TData,\n rowIndex: number,\n depth: number,\n subRows?: Array<Row<TFeatures, TData>>,\n parentId?: string,\n): Row<TFeatures, TData> => {\n // Create row with shared prototype for memory efficiency\n const rowPrototype = getRowPrototype(table)\n const row = Object.create(rowPrototype) as Row_CoreProperties<\n TFeatures,\n TData\n >\n\n // Only assign instance-specific properties\n row._uniqueValuesCache =
|
|
1
|
+
{"version":3,"file":"constructRow.js","names":[],"sources":["../../../src/core/rows/constructRow.ts"],"sourcesContent":["import { makeObjectMap } from '../../utils'\nimport type { Table_Internal } from '../../types/Table'\nimport type { RowData } from '../../types/type-utils'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { Row } from '../../types/Row'\nimport type { Row_CoreProperties } from './coreRowsFeature.types'\n\n/**\n * Creates or retrieves the row prototype for a table.\n * The prototype is cached on the table and shared by all row instances.\n */\nfunction getRowPrototype<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): object {\n if (!table._rowPrototype) {\n table._rowPrototype = { table }\n const features = Object.values(table._features)\n for (let i = 0; i < features.length; i++) {\n features[i]!.assignRowPrototype?.(table._rowPrototype, table)\n }\n }\n return table._rowPrototype\n}\n\n/**\n * Constructs a row instance from normalized table internals.\n *\n * This wires core properties, feature prototype APIs, and instance data used by table rendering and row-model operations.\n */\nexport const constructRow = <\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n id: string,\n original: TData,\n rowIndex: number,\n depth: number,\n subRows?: Array<Row<TFeatures, TData>>,\n parentId?: string,\n): Row<TFeatures, TData> => {\n // Create row with shared prototype for memory efficiency\n const rowPrototype = getRowPrototype(table)\n const row = Object.create(rowPrototype) as Row_CoreProperties<\n TFeatures,\n TData\n >\n\n // Only assign instance-specific properties\n row._uniqueValuesCache = makeObjectMap()\n row._valuesCache = makeObjectMap()\n row.depth = depth\n row.id = id\n row.index = rowIndex\n row.original = original\n row.parentId = parentId\n row.subRows = subRows ?? []\n\n // Initialize instance-specific data (e.g., caches) for features that need it\n const features = Object.values(table._features)\n for (let i = 0; i < features.length; i++) {\n features[i]!.initRowInstanceData?.(row)\n }\n\n return row as Row<TFeatures, TData>\n}\n"],"mappings":";;;;;;;AAWA,SAAS,gBAGP,OAAiD;CACjD,IAAI,CAAC,MAAM,eAAe;EACxB,MAAM,gBAAgB,EAAE,MAAM;EAC9B,MAAM,WAAW,OAAO,OAAO,MAAM,SAAS;EAC9C,KAAK,IAAI,IAAI,GAAG,IAAI,SAAS,QAAQ,KAAK;;GACxC,wCAAS,IAAI,iGAAqB,MAAM,eAAe,KAAK;EAC9D;CACF;CACA,OAAO,MAAM;AACf;;;;;;AAOA,MAAa,gBAIX,OACA,IACA,UACA,UACA,OACA,SACA,aAC0B;CAE1B,MAAM,eAAe,gBAAgB,KAAK;CAC1C,MAAM,MAAM,OAAO,OAAO,YAAY;CAMtC,IAAI,qBAAqB,cAAc;CACvC,IAAI,eAAe,cAAc;CACjC,IAAI,QAAQ;CACZ,IAAI,KAAK;CACT,IAAI,QAAQ;CACZ,IAAI,WAAW;CACf,IAAI,WAAW;CACf,IAAI,UAAU,WAAW,CAAC;CAG1B,MAAM,WAAW,OAAO,OAAO,MAAM,SAAS;CAC9C,KAAK,IAAI,IAAI,GAAG,IAAI,SAAS,QAAQ,KAAK;;EACxC,0CAAS,IAAI,qGAAsB,GAAG;CACxC;CAEA,OAAO;AACT"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RowData } from "../../types/type-utils.cjs";
|
|
2
2
|
import { Row } from "../../types/Row.cjs";
|
|
3
|
-
import {
|
|
3
|
+
import { Table } from "../../types/Table.cjs";
|
|
4
4
|
import { TableFeatures } from "../../types/TableFeatures.cjs";
|
|
5
5
|
import { Cell } from "../../types/Cell.cjs";
|
|
6
6
|
|
|
@@ -39,7 +39,7 @@ interface Row_CoreProperties<in out TFeatures extends TableFeatures, in out TDat
|
|
|
39
39
|
/**
|
|
40
40
|
* Reference to the parent table instance.
|
|
41
41
|
*/
|
|
42
|
-
table:
|
|
42
|
+
table: Table<TFeatures, TData>;
|
|
43
43
|
}
|
|
44
44
|
interface Row_Row<in out TFeatures extends TableFeatures, in out TData extends RowData> extends Row_CoreProperties<TFeatures, TData> {
|
|
45
45
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RowData } from "../../types/type-utils.js";
|
|
2
2
|
import { Row } from "../../types/Row.js";
|
|
3
|
-
import {
|
|
3
|
+
import { Table } from "../../types/Table.js";
|
|
4
4
|
import { TableFeatures } from "../../types/TableFeatures.js";
|
|
5
5
|
import { Cell } from "../../types/Cell.js";
|
|
6
6
|
|
|
@@ -39,7 +39,7 @@ interface Row_CoreProperties<in out TFeatures extends TableFeatures, in out TDat
|
|
|
39
39
|
/**
|
|
40
40
|
* Reference to the parent table instance.
|
|
41
41
|
*/
|
|
42
|
-
table:
|
|
42
|
+
table: Table<TFeatures, TData>;
|
|
43
43
|
}
|
|
44
44
|
interface Row_Row<in out TFeatures extends TableFeatures, in out TData extends RowData> extends Row_CoreProperties<TFeatures, TData> {
|
|
45
45
|
/**
|
|
@@ -14,7 +14,7 @@ const require_constructCell = require('../cells/constructCell.cjs');
|
|
|
14
14
|
* ```
|
|
15
15
|
*/
|
|
16
16
|
function row_getValue(row, columnId) {
|
|
17
|
-
if (row._valuesCache
|
|
17
|
+
if (require_utils.hasOwn(row._valuesCache, columnId)) return row._valuesCache[columnId];
|
|
18
18
|
const column = row.table.getColumn(columnId);
|
|
19
19
|
if (!(column === null || column === void 0 ? void 0 : column.accessorFn)) return;
|
|
20
20
|
row._valuesCache[columnId] = column.accessorFn(row.original, row.index);
|
|
@@ -32,7 +32,7 @@ function row_getValue(row, columnId) {
|
|
|
32
32
|
* ```
|
|
33
33
|
*/
|
|
34
34
|
function row_getUniqueValues(row, columnId) {
|
|
35
|
-
if (row._uniqueValuesCache
|
|
35
|
+
if (require_utils.hasOwn(row._uniqueValuesCache, columnId)) return row._uniqueValuesCache[columnId];
|
|
36
36
|
const column = row.table.getColumn(columnId);
|
|
37
37
|
if (!(column === null || column === void 0 ? void 0 : column.accessorFn)) return;
|
|
38
38
|
if (!column.columnDef.getUniqueValues) {
|
|
@@ -132,7 +132,7 @@ function row_getAllCells(row) {
|
|
|
132
132
|
* ```
|
|
133
133
|
*/
|
|
134
134
|
function row_getAllCellsByColumnId(row) {
|
|
135
|
-
const result =
|
|
135
|
+
const result = require_utils.makeObjectMap();
|
|
136
136
|
const cells = row.getAllCells();
|
|
137
137
|
for (let i = 0; i < cells.length; i++) {
|
|
138
138
|
const cell = cells[i];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coreRowsFeature.utils.cjs","names":["flattenBy","constructCell"],"sources":["../../../src/core/rows/coreRowsFeature.utils.ts"],"sourcesContent":["import { flattenBy } from '../../utils'\nimport { constructCell } from '../cells/constructCell'\nimport type { Table_Internal } from '../../types/Table'\nimport type { RowData } from '../../types/type-utils'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { Row } from '../../types/Row'\nimport type { Cell } from '../../types/Cell'\n\n/**\n * Reads and caches this row's value for a column.\n *\n * The value is produced by the column accessor. Missing columns or display\n * columns without an accessor return `undefined`.\n *\n * @example\n * ```ts\n * const firstName = row_getValue(row, 'firstName')\n * ```\n */\nexport function row_getValue<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>, columnId: string) {\n if (row._valuesCache
|
|
1
|
+
{"version":3,"file":"coreRowsFeature.utils.cjs","names":["hasOwn","flattenBy","constructCell","makeObjectMap"],"sources":["../../../src/core/rows/coreRowsFeature.utils.ts"],"sourcesContent":["import { flattenBy, hasOwn, makeObjectMap } from '../../utils'\nimport { constructCell } from '../cells/constructCell'\nimport type { Table_Internal } from '../../types/Table'\nimport type { RowData } from '../../types/type-utils'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { Row } from '../../types/Row'\nimport type { Cell } from '../../types/Cell'\n\n/**\n * Reads and caches this row's value for a column.\n *\n * The value is produced by the column accessor. Missing columns or display\n * columns without an accessor return `undefined`.\n *\n * @example\n * ```ts\n * const firstName = row_getValue(row, 'firstName')\n * ```\n */\nexport function row_getValue<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>, columnId: string) {\n if (hasOwn(row._valuesCache, columnId)) {\n return row._valuesCache[columnId]\n }\n\n const column = row.table.getColumn(columnId)\n\n if (!column?.accessorFn) {\n return undefined\n }\n\n row._valuesCache[columnId] = column.accessorFn(row.original, row.index)\n\n return row._valuesCache[columnId]\n}\n\n/**\n * Reads and caches the values used by faceting/grouping for a column.\n *\n * If the column defines `getUniqueValues`, that result is used. Otherwise the\n * row's accessor value is wrapped in a single-item array.\n *\n * @example\n * ```ts\n * const values = row_getUniqueValues(row, 'tags')\n * ```\n */\nexport function row_getUniqueValues<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>, columnId: string) {\n if (hasOwn(row._uniqueValuesCache, columnId)) {\n return row._uniqueValuesCache[columnId]\n }\n\n const column = row.table.getColumn(columnId)\n\n if (!column?.accessorFn) {\n return undefined\n }\n\n if (!column.columnDef.getUniqueValues) {\n row._uniqueValuesCache[columnId] = [row.getValue(columnId)]\n return row._uniqueValuesCache[columnId]\n }\n\n row._uniqueValuesCache[columnId] = column.columnDef.getUniqueValues(\n row.original,\n row.index,\n )\n\n return row._uniqueValuesCache[columnId]\n}\n\n/**\n * Returns a renderable row value for a column.\n *\n * If the accessor value is nullish, the table's `renderFallbackValue` is used\n * instead.\n *\n * @example\n * ```ts\n * const value = row_renderValue(row, 'firstName')\n * ```\n */\nexport function row_renderValue<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>, columnId: string) {\n return row.getValue(columnId) ?? row.table.options.renderFallbackValue\n}\n\n/**\n * Flattens this row's descendant tree into leaf rows.\n *\n * The row itself is not included; only nested `subRows` are walked.\n *\n * @example\n * ```ts\n * const descendants = row_getLeafRows(row)\n * ```\n */\nexport function row_getLeafRows<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>): Array<Row<TFeatures, TData>> {\n return flattenBy(row.subRows, (d) => d.subRows)\n}\n\n/**\n * Looks up this row's direct parent, if it has one.\n *\n * Parent lookup searches the pre-pagination row model so parent relationships\n * are available even when the parent is not on the current page.\n *\n * @example\n * ```ts\n * const parent = row_getParentRow(row)\n * ```\n */\nexport function row_getParentRow<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>) {\n return row.parentId ? row.table.getRow(row.parentId, true) : undefined\n}\n\n/**\n * Collects this row's ancestor chain from root to direct parent.\n *\n * The current row is not included. Rows without a parent return an empty array.\n *\n * @example\n * ```ts\n * const ancestors = row_getParentRows(row)\n * ```\n */\nexport function row_getParentRows<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>) {\n const parentRows: Array<Row<TFeatures, TData>> = []\n let currentRow = row\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n while (true) {\n const parentRow = currentRow.getParentRow()\n if (!parentRow) break\n parentRows.push(parentRow)\n currentRow = parentRow\n }\n return parentRows.reverse()\n}\n\n/**\n * Constructs one cell for each leaf column in this row.\n *\n * The result follows `table.getAllLeafColumns()` order and includes hidden\n * columns; visibility-specific APIs filter this list later.\n *\n * @example\n * ```ts\n * const cells = row_getAllCells(row)\n * ```\n */\nexport function row_getAllCells<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>): Array<Cell<TFeatures, TData, unknown>> {\n const columns = row.table.getAllLeafColumns()\n const cells: Array<Cell<TFeatures, TData, unknown>> = new Array(\n columns.length,\n )\n for (let i = 0; i < columns.length; i++) {\n cells[i] = constructCell(columns[i]!, row, row.table)\n }\n return cells\n}\n\n/**\n * Builds a lookup map of this row's cells keyed by column id.\n *\n * This is the static implementation behind `row.getAllCellsByColumnId()`.\n *\n * @example\n * ```ts\n * const cellsById = row_getAllCellsByColumnId(row)\n * ```\n */\nexport function row_getAllCellsByColumnId<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>) {\n const result = makeObjectMap<Cell<TFeatures, TData, unknown>>()\n const cells = row.getAllCells()\n for (let i = 0; i < cells.length; i++) {\n const cell = cells[i]!\n result[cell.column.id] = cell\n }\n return result\n}\n\n/**\n * Resolves the stable id for a row.\n *\n * `options.getRowId` wins when provided. Otherwise root rows use their index\n * and child rows append their index to the parent id, such as `0.2`.\n *\n * @example\n * ```ts\n * const id = table_getRowId(originalRow, table, index, parentRow)\n * ```\n */\nexport function table_getRowId<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n originalRow: TData,\n table: Table_Internal<TFeatures, TData>,\n index: number,\n parent?: Row<TFeatures, TData>,\n) {\n return (\n table.options.getRowId?.(originalRow, index, parent) ??\n `${parent ? [parent.id, index].join('.') : index}`\n )\n}\n\n/**\n * Looks up a row by id from the current or full row model.\n *\n * By default this searches `table.getRowModel()`. Passing `searchAll` searches\n * the pre-pagination model first, then falls back to the core model.\n *\n * @example\n * ```ts\n * const row = table_getRow(table, rowId, true)\n * ```\n */\nexport function table_getRow<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n rowId: string,\n searchAll?: boolean,\n): Row<TFeatures, TData> {\n // TODO - simplify this across different row models\n let row = (searchAll ? table.getPrePaginatedRowModel() : table.getRowModel())\n .rowsById[rowId]\n\n if (!row) {\n row = table.getCoreRowModel().rowsById[rowId]\n if (!row) {\n if (process.env.NODE_ENV === 'development') {\n throw new Error(`getRow could not find row with ID: ${rowId}`)\n }\n throw new Error()\n }\n }\n\n return row\n}\n"],"mappings":";;;;;;;;;;;;;;;AAmBA,SAAgB,aAGd,KAA4B,UAAkB;CAC9C,IAAIA,qBAAO,IAAI,cAAc,QAAQ,GACnC,OAAO,IAAI,aAAa;CAG1B,MAAM,SAAS,IAAI,MAAM,UAAU,QAAQ;CAE3C,IAAI,kDAAC,OAAQ,aACX;CAGF,IAAI,aAAa,YAAY,OAAO,WAAW,IAAI,UAAU,IAAI,KAAK;CAEtE,OAAO,IAAI,aAAa;AAC1B;;;;;;;;;;;;AAaA,SAAgB,oBAGd,KAA4B,UAAkB;CAC9C,IAAIA,qBAAO,IAAI,oBAAoB,QAAQ,GACzC,OAAO,IAAI,mBAAmB;CAGhC,MAAM,SAAS,IAAI,MAAM,UAAU,QAAQ;CAE3C,IAAI,kDAAC,OAAQ,aACX;CAGF,IAAI,CAAC,OAAO,UAAU,iBAAiB;EACrC,IAAI,mBAAmB,YAAY,CAAC,IAAI,SAAS,QAAQ,CAAC;EAC1D,OAAO,IAAI,mBAAmB;CAChC;CAEA,IAAI,mBAAmB,YAAY,OAAO,UAAU,gBAClD,IAAI,UACJ,IAAI,KACN;CAEA,OAAO,IAAI,mBAAmB;AAChC;;;;;;;;;;;;AAaA,SAAgB,gBAGd,KAA4B,UAAkB;CAC9C,OAAO,IAAI,SAAS,QAAQ,KAAK,IAAI,MAAM,QAAQ;AACrD;;;;;;;;;;;AAYA,SAAgB,gBAGd,KAA0D;CAC1D,OAAOC,wBAAU,IAAI,UAAU,MAAM,EAAE,OAAO;AAChD;;;;;;;;;;;;AAaA,SAAgB,iBAGd,KAA4B;CAC5B,OAAO,IAAI,WAAW,IAAI,MAAM,OAAO,IAAI,UAAU,IAAI,IAAI;AAC/D;;;;;;;;;;;AAYA,SAAgB,kBAGd,KAA4B;CAC5B,MAAM,aAA2C,CAAC;CAClD,IAAI,aAAa;CAEjB,OAAO,MAAM;EACX,MAAM,YAAY,WAAW,aAAa;EAC1C,IAAI,CAAC,WAAW;EAChB,WAAW,KAAK,SAAS;EACzB,aAAa;CACf;CACA,OAAO,WAAW,QAAQ;AAC5B;;;;;;;;;;;;AAaA,SAAgB,gBAGd,KAAoE;CACpE,MAAM,UAAU,IAAI,MAAM,kBAAkB;CAC5C,MAAM,QAAgD,IAAI,MACxD,QAAQ,MACV;CACA,KAAK,IAAI,IAAI,GAAG,IAAI,QAAQ,QAAQ,KAClC,MAAM,KAAKC,oCAAc,QAAQ,IAAK,KAAK,IAAI,KAAK;CAEtD,OAAO;AACT;;;;;;;;;;;AAYA,SAAgB,0BAGd,KAA4B;CAC5B,MAAM,SAASC,4BAA+C;CAC9D,MAAM,QAAQ,IAAI,YAAY;CAC9B,KAAK,IAAI,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK;EACrC,MAAM,OAAO,MAAM;EACnB,OAAO,KAAK,OAAO,MAAM;CAC3B;CACA,OAAO;AACT;;;;;;;;;;;;AAaA,SAAgB,eAId,aACA,OACA,OACA,QACA;;CACA,mDACE,MAAM,SAAQ,6GAAW,aAAa,OAAO,MAAM,MACnD,GAAG,SAAS,CAAC,OAAO,IAAI,KAAK,CAAC,CAAC,KAAK,GAAG,IAAI;AAE/C;;;;;;;;;;;;AAaA,SAAgB,aAId,OACA,OACA,WACuB;CAEvB,IAAI,OAAO,YAAY,MAAM,wBAAwB,IAAI,MAAM,YAAY,EAAC,CACzE,SAAS;CAEZ,IAAI,CAAC,KAAK;EACR,MAAM,MAAM,gBAAgB,CAAC,CAAC,SAAS;EACvC,IAAI,CAAC,KAAK;GACR,IAAI,QAAQ,IAAI,aAAa,eAC3B,MAAM,IAAI,MAAM,sCAAsC,OAAO;GAE/D,MAAM,IAAI,MAAM;EAClB;CACF;CAEA,OAAO;AACT"}
|