@tanstack/table-core 9.0.0-beta.10 → 9.0.0-beta.12
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/coreCellsFeature.types.d.cts +3 -3
- package/dist/core/cells/coreCellsFeature.types.d.ts +3 -3
- package/dist/core/columns/coreColumnsFeature.types.d.cts +4 -4
- package/dist/core/columns/coreColumnsFeature.types.d.ts +4 -4
- package/dist/core/columns/coreColumnsFeature.utils.cjs.map +1 -1
- package/dist/core/columns/coreColumnsFeature.utils.js.map +1 -1
- package/dist/core/headers/buildHeaderGroups.cjs.map +1 -1
- package/dist/core/headers/buildHeaderGroups.js.map +1 -1
- package/dist/core/headers/coreHeadersFeature.types.d.cts +5 -5
- package/dist/core/headers/coreHeadersFeature.types.d.ts +5 -5
- package/dist/core/row-models/coreRowModelsFeature.types.d.cts +3 -3
- package/dist/core/row-models/coreRowModelsFeature.types.d.ts +3 -3
- package/dist/core/row-models/createCoreRowModel.cjs +1 -2
- 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 +1 -2
- package/dist/core/row-models/createCoreRowModel.js.map +1 -1
- package/dist/core/rows/coreRowsFeature.types.d.cts +4 -4
- package/dist/core/rows/coreRowsFeature.types.d.ts +4 -4
- package/dist/core/table/constructTable.cjs.map +1 -1
- package/dist/core/table/constructTable.js.map +1 -1
- package/dist/core/table/coreTablesFeature.types.d.cts +4 -4
- package/dist/core/table/coreTablesFeature.types.d.ts +4 -4
- package/dist/core/table/coreTablesFeature.utils.cjs.map +1 -1
- package/dist/core/table/coreTablesFeature.utils.js.map +1 -1
- package/dist/features/column-faceting/columnFacetingFeature.types.d.cts +4 -4
- package/dist/features/column-faceting/columnFacetingFeature.types.d.ts +4 -4
- package/dist/features/column-filtering/columnFilteringFeature.types.d.cts +9 -9
- package/dist/features/column-filtering/columnFilteringFeature.types.d.ts +9 -9
- package/dist/features/column-filtering/columnFilteringFeature.utils.cjs.map +1 -1
- package/dist/features/column-filtering/columnFilteringFeature.utils.js.map +1 -1
- package/dist/features/column-grouping/columnGroupingFeature.types.d.cts +6 -6
- package/dist/features/column-grouping/columnGroupingFeature.types.d.ts +6 -6
- package/dist/features/column-ordering/columnOrderingFeature.types.d.cts +1 -1
- package/dist/features/column-ordering/columnOrderingFeature.types.d.ts +1 -1
- package/dist/features/column-pinning/columnPinningFeature.types.d.cts +2 -2
- package/dist/features/column-pinning/columnPinningFeature.types.d.ts +2 -2
- package/dist/features/column-pinning/columnPinningFeature.utils.cjs.map +1 -1
- package/dist/features/column-pinning/columnPinningFeature.utils.d.cts +3 -2
- package/dist/features/column-pinning/columnPinningFeature.utils.d.ts +3 -2
- package/dist/features/column-pinning/columnPinningFeature.utils.js.map +1 -1
- package/dist/features/column-resizing/columnResizingFeature.types.d.cts +1 -4
- package/dist/features/column-resizing/columnResizingFeature.types.d.ts +1 -4
- package/dist/features/column-visibility/columnVisibilityFeature.types.d.cts +2 -2
- package/dist/features/column-visibility/columnVisibilityFeature.types.d.ts +2 -2
- package/dist/features/global-filtering/globalFilteringFeature.types.d.cts +2 -2
- package/dist/features/global-filtering/globalFilteringFeature.types.d.ts +2 -2
- package/dist/features/global-filtering/globalFilteringFeature.utils.cjs.map +1 -1
- package/dist/features/global-filtering/globalFilteringFeature.utils.js.map +1 -1
- package/dist/features/row-expanding/rowExpandingFeature.types.d.cts +4 -4
- package/dist/features/row-expanding/rowExpandingFeature.types.d.ts +4 -4
- package/dist/features/row-pagination/rowPaginationFeature.types.d.cts +3 -3
- package/dist/features/row-pagination/rowPaginationFeature.types.d.ts +3 -3
- package/dist/features/row-pinning/rowPinningFeature.types.d.cts +2 -2
- package/dist/features/row-pinning/rowPinningFeature.types.d.ts +2 -2
- package/dist/features/row-selection/rowSelectionFeature.types.d.cts +2 -2
- package/dist/features/row-selection/rowSelectionFeature.types.d.ts +2 -2
- package/dist/features/row-sorting/rowSortingFeature.types.d.cts +7 -7
- package/dist/features/row-sorting/rowSortingFeature.types.d.ts +7 -7
- package/dist/helpers/columnHelper.cjs.map +1 -1
- package/dist/helpers/columnHelper.d.cts +2 -2
- package/dist/helpers/columnHelper.d.ts +2 -2
- package/dist/helpers/columnHelper.js.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/types/Cell.d.cts +1 -1
- package/dist/types/Cell.d.ts +1 -1
- package/dist/types/Column.d.cts +4 -4
- package/dist/types/Column.d.ts +4 -4
- package/dist/types/ColumnDef.d.cts +3 -3
- package/dist/types/ColumnDef.d.ts +3 -3
- package/dist/types/Header.d.cts +1 -1
- package/dist/types/Header.d.ts +1 -1
- package/dist/types/HeaderGroup.d.cts +2 -2
- package/dist/types/HeaderGroup.d.ts +2 -2
- package/dist/types/Row.d.cts +2 -2
- package/dist/types/Row.d.ts +2 -2
- package/dist/types/RowModel.d.cts +2 -2
- package/dist/types/RowModel.d.ts +2 -2
- package/dist/types/RowModelFns.d.cts +2 -2
- package/dist/types/RowModelFns.d.ts +2 -2
- package/dist/types/Table.d.cts +21 -12
- package/dist/types/Table.d.ts +21 -12
- package/dist/types/TableOptions.d.cts +11 -5
- package/dist/types/TableOptions.d.ts +11 -5
- package/dist/types/TableState.d.cts +1 -1
- package/dist/types/TableState.d.ts +1 -1
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.cts +7 -2
- package/dist/utils.d.ts +7 -2
- package/dist/utils.js.map +1 -1
- package/package.json +1 -1
- package/src/core/cells/coreCellsFeature.types.ts +6 -6
- package/src/core/columns/coreColumnsFeature.types.ts +8 -8
- package/src/core/columns/coreColumnsFeature.utils.ts +1 -1
- package/src/core/headers/buildHeaderGroups.ts +3 -1
- package/src/core/headers/coreHeadersFeature.types.ts +10 -10
- package/src/core/row-models/coreRowModelsFeature.types.ts +6 -6
- package/src/core/row-models/createCoreRowModel.ts +5 -4
- package/src/core/rows/coreRowsFeature.types.ts +8 -8
- package/src/core/table/constructTable.ts +1 -1
- package/src/core/table/coreTablesFeature.types.ts +8 -8
- package/src/core/table/coreTablesFeature.utils.ts +8 -2
- package/src/features/column-faceting/columnFacetingFeature.types.ts +8 -8
- package/src/features/column-filtering/columnFilteringFeature.types.ts +18 -18
- package/src/features/column-filtering/columnFilteringFeature.utils.ts +1 -1
- package/src/features/column-grouping/columnGroupingFeature.types.ts +12 -12
- package/src/features/column-ordering/columnOrderingFeature.types.ts +2 -2
- package/src/features/column-pinning/columnPinningFeature.types.ts +4 -4
- package/src/features/column-pinning/columnPinningFeature.utils.ts +6 -14
- package/src/features/column-resizing/columnResizingFeature.types.ts +1 -4
- package/src/features/column-visibility/columnVisibilityFeature.types.ts +4 -4
- package/src/features/global-filtering/globalFilteringFeature.types.ts +4 -4
- package/src/features/global-filtering/globalFilteringFeature.utils.ts +1 -1
- package/src/features/row-expanding/rowExpandingFeature.types.ts +8 -8
- package/src/features/row-pagination/rowPaginationFeature.types.ts +6 -6
- package/src/features/row-pinning/rowPinningFeature.types.ts +4 -4
- package/src/features/row-selection/rowSelectionFeature.types.ts +4 -4
- package/src/features/row-sorting/rowSortingFeature.types.ts +14 -14
- package/src/helpers/columnHelper.ts +4 -4
- package/src/types/Cell.ts +2 -2
- package/src/types/Column.ts +8 -8
- package/src/types/ColumnDef.ts +6 -6
- package/src/types/Header.ts +2 -2
- package/src/types/HeaderGroup.ts +6 -6
- package/src/types/Row.ts +4 -4
- package/src/types/RowModel.ts +7 -7
- package/src/types/RowModelFns.ts +7 -7
- package/src/types/Table.ts +51 -25
- package/src/types/TableOptions.ts +54 -12
- package/src/types/TableState.ts +15 -1
- package/src/utils.ts +11 -2
|
@@ -6,7 +6,7 @@ import { TableFeatures } from "../../types/TableFeatures.cjs";
|
|
|
6
6
|
import { Cell } from "../../types/Cell.cjs";
|
|
7
7
|
|
|
8
8
|
//#region src/core/cells/coreCellsFeature.types.d.ts
|
|
9
|
-
interface CellContext<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData> {
|
|
9
|
+
interface CellContext<in out TFeatures extends TableFeatures, in out TData extends RowData, TValue extends CellData = CellData> {
|
|
10
10
|
cell: Cell<TFeatures, TData, TValue>;
|
|
11
11
|
column: Column<TFeatures, TData, TValue>;
|
|
12
12
|
getValue: Getter<TValue>;
|
|
@@ -14,7 +14,7 @@ interface CellContext<TFeatures extends TableFeatures, TData extends RowData, TV
|
|
|
14
14
|
row: Row<TFeatures, TData>;
|
|
15
15
|
table: Table<TFeatures, TData>;
|
|
16
16
|
}
|
|
17
|
-
interface Cell_CoreProperties<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData> {
|
|
17
|
+
interface Cell_CoreProperties<in out TFeatures extends TableFeatures, in out TData extends RowData, TValue extends CellData = CellData> {
|
|
18
18
|
/**
|
|
19
19
|
* The associated Column object for the cell.
|
|
20
20
|
*/
|
|
@@ -32,7 +32,7 @@ interface Cell_CoreProperties<TFeatures extends TableFeatures, TData extends Row
|
|
|
32
32
|
*/
|
|
33
33
|
table: Table_Internal<TFeatures, TData>;
|
|
34
34
|
}
|
|
35
|
-
interface Cell_Cell<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData> extends Cell_CoreProperties<TFeatures, TData, TValue> {
|
|
35
|
+
interface Cell_Cell<in out TFeatures extends TableFeatures, in out TData extends RowData, TValue extends CellData = CellData> extends Cell_CoreProperties<TFeatures, TData, TValue> {
|
|
36
36
|
/**
|
|
37
37
|
* Returns the rendering context (or props) for cell-based components like cells and aggregated cells. Use these props with your framework's `flexRender` utility to render these using the template of your choice:
|
|
38
38
|
*/
|
|
@@ -6,7 +6,7 @@ import { TableFeatures } from "../../types/TableFeatures.js";
|
|
|
6
6
|
import { Cell } from "../../types/Cell.js";
|
|
7
7
|
|
|
8
8
|
//#region src/core/cells/coreCellsFeature.types.d.ts
|
|
9
|
-
interface CellContext<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData> {
|
|
9
|
+
interface CellContext<in out TFeatures extends TableFeatures, in out TData extends RowData, TValue extends CellData = CellData> {
|
|
10
10
|
cell: Cell<TFeatures, TData, TValue>;
|
|
11
11
|
column: Column<TFeatures, TData, TValue>;
|
|
12
12
|
getValue: Getter<TValue>;
|
|
@@ -14,7 +14,7 @@ interface CellContext<TFeatures extends TableFeatures, TData extends RowData, TV
|
|
|
14
14
|
row: Row<TFeatures, TData>;
|
|
15
15
|
table: Table<TFeatures, TData>;
|
|
16
16
|
}
|
|
17
|
-
interface Cell_CoreProperties<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData> {
|
|
17
|
+
interface Cell_CoreProperties<in out TFeatures extends TableFeatures, in out TData extends RowData, TValue extends CellData = CellData> {
|
|
18
18
|
/**
|
|
19
19
|
* The associated Column object for the cell.
|
|
20
20
|
*/
|
|
@@ -32,7 +32,7 @@ interface Cell_CoreProperties<TFeatures extends TableFeatures, TData extends Row
|
|
|
32
32
|
*/
|
|
33
33
|
table: Table_Internal<TFeatures, TData>;
|
|
34
34
|
}
|
|
35
|
-
interface Cell_Cell<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData> extends Cell_CoreProperties<TFeatures, TData, TValue> {
|
|
35
|
+
interface Cell_Cell<in out TFeatures extends TableFeatures, in out TData extends RowData, TValue extends CellData = CellData> extends Cell_CoreProperties<TFeatures, TData, TValue> {
|
|
36
36
|
/**
|
|
37
37
|
* Returns the rendering context (or props) for cell-based components like cells and aggregated cells. Use these props with your framework's `flexRender` utility to render these using the template of your choice:
|
|
38
38
|
*/
|
|
@@ -5,7 +5,7 @@ import { AccessorFn, ColumnDef } from "../../types/ColumnDef.cjs";
|
|
|
5
5
|
import { TableFeatures } from "../../types/TableFeatures.cjs";
|
|
6
6
|
|
|
7
7
|
//#region src/core/columns/coreColumnsFeature.types.d.ts
|
|
8
|
-
interface Column_CoreProperties<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData> {
|
|
8
|
+
interface Column_CoreProperties<in out TFeatures extends TableFeatures, in out TData extends RowData, TValue extends CellData = CellData> {
|
|
9
9
|
/**
|
|
10
10
|
* The resolved accessor function to use when extracting the value for the column from each row. Will only be defined if the column def has a valid accessor key or function defined.
|
|
11
11
|
*/
|
|
@@ -38,7 +38,7 @@ interface Column_CoreProperties<TFeatures extends TableFeatures, TData extends R
|
|
|
38
38
|
*/
|
|
39
39
|
table: Table_Internal<TFeatures, TData>;
|
|
40
40
|
}
|
|
41
|
-
interface Column_Column<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData> extends Column_CoreProperties<TFeatures, TData, TValue> {
|
|
41
|
+
interface Column_Column<in out TFeatures extends TableFeatures, in out TData extends RowData, TValue extends CellData = CellData> extends Column_CoreProperties<TFeatures, TData, TValue> {
|
|
42
42
|
/**
|
|
43
43
|
* Flattens this column and every descendant column into a single array.
|
|
44
44
|
*/
|
|
@@ -49,7 +49,7 @@ interface Column_Column<TFeatures extends TableFeatures, TData extends RowData,
|
|
|
49
49
|
*/
|
|
50
50
|
getLeafColumns: () => Array<Column<TFeatures, TData, TValue>>;
|
|
51
51
|
}
|
|
52
|
-
interface TableOptions_Columns<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData> {
|
|
52
|
+
interface TableOptions_Columns<in out TFeatures extends TableFeatures, in out TData extends RowData, TValue extends CellData = CellData> {
|
|
53
53
|
/**
|
|
54
54
|
* The array of column defs to use for the table.
|
|
55
55
|
*/
|
|
@@ -59,7 +59,7 @@ interface TableOptions_Columns<TFeatures extends TableFeatures, TData extends Ro
|
|
|
59
59
|
*/
|
|
60
60
|
defaultColumn?: Partial<ColumnDef<TFeatures, TData, TValue>>;
|
|
61
61
|
}
|
|
62
|
-
interface Table_Columns<TFeatures extends TableFeatures, TData extends RowData> {
|
|
62
|
+
interface Table_Columns<in out TFeatures extends TableFeatures, in out TData extends RowData> {
|
|
63
63
|
/**
|
|
64
64
|
* Returns a map of all flat columns by their ID.
|
|
65
65
|
*/
|
|
@@ -5,7 +5,7 @@ import { AccessorFn, ColumnDef } from "../../types/ColumnDef.js";
|
|
|
5
5
|
import { TableFeatures } from "../../types/TableFeatures.js";
|
|
6
6
|
|
|
7
7
|
//#region src/core/columns/coreColumnsFeature.types.d.ts
|
|
8
|
-
interface Column_CoreProperties<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData> {
|
|
8
|
+
interface Column_CoreProperties<in out TFeatures extends TableFeatures, in out TData extends RowData, TValue extends CellData = CellData> {
|
|
9
9
|
/**
|
|
10
10
|
* The resolved accessor function to use when extracting the value for the column from each row. Will only be defined if the column def has a valid accessor key or function defined.
|
|
11
11
|
*/
|
|
@@ -38,7 +38,7 @@ interface Column_CoreProperties<TFeatures extends TableFeatures, TData extends R
|
|
|
38
38
|
*/
|
|
39
39
|
table: Table_Internal<TFeatures, TData>;
|
|
40
40
|
}
|
|
41
|
-
interface Column_Column<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData> extends Column_CoreProperties<TFeatures, TData, TValue> {
|
|
41
|
+
interface Column_Column<in out TFeatures extends TableFeatures, in out TData extends RowData, TValue extends CellData = CellData> extends Column_CoreProperties<TFeatures, TData, TValue> {
|
|
42
42
|
/**
|
|
43
43
|
* Flattens this column and every descendant column into a single array.
|
|
44
44
|
*/
|
|
@@ -49,7 +49,7 @@ interface Column_Column<TFeatures extends TableFeatures, TData extends RowData,
|
|
|
49
49
|
*/
|
|
50
50
|
getLeafColumns: () => Array<Column<TFeatures, TData, TValue>>;
|
|
51
51
|
}
|
|
52
|
-
interface TableOptions_Columns<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData> {
|
|
52
|
+
interface TableOptions_Columns<in out TFeatures extends TableFeatures, in out TData extends RowData, TValue extends CellData = CellData> {
|
|
53
53
|
/**
|
|
54
54
|
* The array of column defs to use for the table.
|
|
55
55
|
*/
|
|
@@ -59,7 +59,7 @@ interface TableOptions_Columns<TFeatures extends TableFeatures, TData extends Ro
|
|
|
59
59
|
*/
|
|
60
60
|
defaultColumn?: Partial<ColumnDef<TFeatures, TData, TValue>>;
|
|
61
61
|
}
|
|
62
|
-
interface Table_Columns<TFeatures extends TableFeatures, TData extends RowData> {
|
|
62
|
+
interface Table_Columns<in out TFeatures extends TableFeatures, in out TData extends RowData> {
|
|
63
63
|
/**
|
|
64
64
|
* Returns a map of all flat columns by their ID.
|
|
65
65
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coreColumnsFeature.utils.cjs","names":["callMemoOrStaticFn","table_getOrderColumnsFn","constructColumn"],"sources":["../../../src/core/columns/coreColumnsFeature.utils.ts"],"sourcesContent":["import { callMemoOrStaticFn } from '../../utils'\nimport { table_getOrderColumnsFn } from '../../features/column-ordering/columnOrderingFeature.utils'\nimport { constructColumn } from './constructColumn'\nimport type { Table_Internal } from '../../types/Table'\nimport type { CellData, RowData } from '../../types/type-utils'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type {\n ColumnDef,\n ColumnDefResolved,\n GroupColumnDef,\n} from '../../types/ColumnDef'\nimport type { Column } from '../../types/Column'\n\n/**\n * Flattens this column and every descendant column into a single array.\n *\n * Group columns appear before their child columns, which matches the normalized\n * column hierarchy produced during table construction.\n *\n * @example\n * ```ts\n * const flatColumns = column_getFlatColumns(column)\n * ```\n */\nexport function column_getFlatColumns<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(\n column: Column<TFeatures, TData, TValue>,\n): Array<Column<TFeatures, TData, TValue>> {\n return [column, ...column.columns.flatMap((col) => col.getFlatColumns())]\n}\n\n/**\n * Collects the terminal leaf columns below this column.\n *\n * Group columns return their ordered descendants. Non-group columns return an\n * array containing only the column itself.\n *\n * @example\n * ```ts\n * const leafColumns = column_getLeafColumns(column)\n * ```\n */\nexport function column_getLeafColumns<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(\n column: Column<TFeatures, TData, TValue>,\n): Array<Column<TFeatures, TData, TValue>> {\n if (column.columns.length) {\n const leafColumns = column.columns.flatMap(\n (col) => col.getLeafColumns(), // recursive\n )\n\n return callMemoOrStaticFn(\n column.table,\n 'getOrderColumns',\n table_getOrderColumnsFn,\n )(leafColumns as any) as any\n }\n\n return [column]\n}\n\n/**\n * Merges built-in, feature, and user default column definitions.\n *\n * Built-in defaults provide a header and fallback cell renderer, feature\n * defaults can add feature-specific column options, and\n * `options.defaultColumn` wins last.\n *\n * @example\n * ```ts\n * const defaultColumn = table_getDefaultColumnDef(table)\n * ```\n */\nexport function table_getDefaultColumnDef<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n): Partial<ColumnDef<TFeatures, TData, unknown>> {\n return {\n header: (props) => {\n const resolvedColumnDef = props.header.column\n .columnDef as ColumnDefResolved<{}, TData>\n\n if (resolvedColumnDef.accessorKey) {\n return resolvedColumnDef.accessorKey\n }\n\n if (resolvedColumnDef.accessorFn) {\n return resolvedColumnDef.id\n }\n\n return null\n },\n cell: (props) => props.renderValue<any>()?.toString?.() ?? null,\n ...Object.values(table._features).reduce((obj, feature) => {\n return Object.assign(obj, feature.getDefaultColumnDef?.())\n }, {}),\n ...table.options.defaultColumn,\n } as Partial<ColumnDef<TFeatures, TData, unknown>>\n}\n\n/**\n * Normalizes `options.columns` into the table's nested column tree.\n *\n * Each column definition is constructed with its parent and depth, and group\n * column children are recursively constructed.\n *\n * @example\n * ```ts\n * const columns = table_getAllColumns(table)\n * ```\n */\nexport function table_getAllColumns<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n): Array<Column<TFeatures, TData, unknown>> {\n const recurseColumns = (\n colDefs: ReadonlyArray<ColumnDef<TFeatures, TData, unknown>>,\n parent?: Column<TFeatures, TData, unknown>,\n depth = 0,\n ): Array<Column<TFeatures, TData, unknown>> => {\n return colDefs.map((columnDef) => {\n const column = constructColumn(table, columnDef, depth, parent)\n\n const groupingColumnDef = columnDef as GroupColumnDef<\n TFeatures,\n TData,\n unknown\n >\n\n column.columns = groupingColumnDef.columns\n ? recurseColumns(groupingColumnDef.columns, column, depth + 1)\n : []\n\n return column\n })\n }\n\n return recurseColumns(table.options.columns)\n}\n\n/**\n * Flattens every table column, including group columns and leaf columns.\n *\n * Use this when parent/group columns must be included in addition to data leaf\n * columns.\n *\n * @example\n * ```ts\n * const flatColumns = table_getAllFlatColumns(table)\n * ```\n */\nexport function table_getAllFlatColumns<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n): Array<Column<TFeatures, TData, unknown>> {\n return table.getAllColumns().flatMap((column) => column.getFlatColumns())\n}\n\n/**\n * Builds an id lookup for every flat column in the table.\n *\n * Group columns and leaf columns are included. Later columns with the same id\n * replace earlier entries.\n *\n * @example\n * ```ts\n * const columnsById = table_getAllFlatColumnsById(table)\n * ```\n */\nexport function table_getAllFlatColumnsById<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n): Record<string, Column<TFeatures, TData, unknown>> {\n const result: Record<string, Column<TFeatures, TData, unknown>> = {}\n const flatColumns = table.getAllFlatColumns()\n for (let i = 0; i < flatColumns.length; i++) {\n const column = flatColumns[i]!\n result[column.id] = column\n }\n return result\n}\n\n/**\n * Collects all terminal leaf columns in their current table order.\n *\n * Column ordering features can reorder the collected leaves before the result\n * is returned.\n *\n * @example\n * ```ts\n * const leafColumns = table_getAllLeafColumns(table)\n * ```\n */\nexport function table_getAllLeafColumns<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n): Array<Column<TFeatures, TData, unknown>> {\n const leafColumns = table.getAllColumns().flatMap(\n (c) => c.getLeafColumns(), // recursive\n )\n return callMemoOrStaticFn(\n table,\n 'getOrderColumns',\n table_getOrderColumnsFn,\n )(leafColumns)
|
|
1
|
+
{"version":3,"file":"coreColumnsFeature.utils.cjs","names":["callMemoOrStaticFn","table_getOrderColumnsFn","constructColumn"],"sources":["../../../src/core/columns/coreColumnsFeature.utils.ts"],"sourcesContent":["import { callMemoOrStaticFn } from '../../utils'\nimport { table_getOrderColumnsFn } from '../../features/column-ordering/columnOrderingFeature.utils'\nimport { constructColumn } from './constructColumn'\nimport type { Table_Internal } from '../../types/Table'\nimport type { CellData, RowData } from '../../types/type-utils'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type {\n ColumnDef,\n ColumnDefResolved,\n GroupColumnDef,\n} from '../../types/ColumnDef'\nimport type { Column } from '../../types/Column'\n\n/**\n * Flattens this column and every descendant column into a single array.\n *\n * Group columns appear before their child columns, which matches the normalized\n * column hierarchy produced during table construction.\n *\n * @example\n * ```ts\n * const flatColumns = column_getFlatColumns(column)\n * ```\n */\nexport function column_getFlatColumns<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(\n column: Column<TFeatures, TData, TValue>,\n): Array<Column<TFeatures, TData, TValue>> {\n return [column, ...column.columns.flatMap((col) => col.getFlatColumns())]\n}\n\n/**\n * Collects the terminal leaf columns below this column.\n *\n * Group columns return their ordered descendants. Non-group columns return an\n * array containing only the column itself.\n *\n * @example\n * ```ts\n * const leafColumns = column_getLeafColumns(column)\n * ```\n */\nexport function column_getLeafColumns<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(\n column: Column<TFeatures, TData, TValue>,\n): Array<Column<TFeatures, TData, TValue>> {\n if (column.columns.length) {\n const leafColumns = column.columns.flatMap(\n (col) => col.getLeafColumns(), // recursive\n )\n\n return callMemoOrStaticFn(\n column.table,\n 'getOrderColumns',\n table_getOrderColumnsFn,\n )(leafColumns as any) as any\n }\n\n return [column]\n}\n\n/**\n * Merges built-in, feature, and user default column definitions.\n *\n * Built-in defaults provide a header and fallback cell renderer, feature\n * defaults can add feature-specific column options, and\n * `options.defaultColumn` wins last.\n *\n * @example\n * ```ts\n * const defaultColumn = table_getDefaultColumnDef(table)\n * ```\n */\nexport function table_getDefaultColumnDef<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n): Partial<ColumnDef<TFeatures, TData, unknown>> {\n return {\n header: (props) => {\n const resolvedColumnDef = props.header.column\n .columnDef as ColumnDefResolved<{}, TData>\n\n if (resolvedColumnDef.accessorKey) {\n return resolvedColumnDef.accessorKey\n }\n\n if (resolvedColumnDef.accessorFn) {\n return resolvedColumnDef.id\n }\n\n return null\n },\n cell: (props) => props.renderValue<any>()?.toString?.() ?? null,\n ...Object.values(table._features).reduce((obj, feature) => {\n return Object.assign(obj, feature.getDefaultColumnDef?.())\n }, {}),\n ...table.options.defaultColumn,\n } as Partial<ColumnDef<TFeatures, TData, unknown>>\n}\n\n/**\n * Normalizes `options.columns` into the table's nested column tree.\n *\n * Each column definition is constructed with its parent and depth, and group\n * column children are recursively constructed.\n *\n * @example\n * ```ts\n * const columns = table_getAllColumns(table)\n * ```\n */\nexport function table_getAllColumns<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n): Array<Column<TFeatures, TData, unknown>> {\n const recurseColumns = (\n colDefs: ReadonlyArray<ColumnDef<TFeatures, TData, unknown>>,\n parent?: Column<TFeatures, TData, unknown>,\n depth = 0,\n ): Array<Column<TFeatures, TData, unknown>> => {\n return colDefs.map((columnDef) => {\n const column = constructColumn(table, columnDef, depth, parent)\n\n const groupingColumnDef = columnDef as GroupColumnDef<\n TFeatures,\n TData,\n unknown\n >\n\n column.columns = groupingColumnDef.columns\n ? recurseColumns(groupingColumnDef.columns, column, depth + 1)\n : []\n\n return column\n })\n }\n\n return recurseColumns(table.options.columns)\n}\n\n/**\n * Flattens every table column, including group columns and leaf columns.\n *\n * Use this when parent/group columns must be included in addition to data leaf\n * columns.\n *\n * @example\n * ```ts\n * const flatColumns = table_getAllFlatColumns(table)\n * ```\n */\nexport function table_getAllFlatColumns<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n): Array<Column<TFeatures, TData, unknown>> {\n return table.getAllColumns().flatMap((column) => column.getFlatColumns())\n}\n\n/**\n * Builds an id lookup for every flat column in the table.\n *\n * Group columns and leaf columns are included. Later columns with the same id\n * replace earlier entries.\n *\n * @example\n * ```ts\n * const columnsById = table_getAllFlatColumnsById(table)\n * ```\n */\nexport function table_getAllFlatColumnsById<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n): Record<string, Column<TFeatures, TData, unknown>> {\n const result: Record<string, Column<TFeatures, TData, unknown>> = {}\n const flatColumns = table.getAllFlatColumns()\n for (let i = 0; i < flatColumns.length; i++) {\n const column = flatColumns[i]!\n result[column.id] = column\n }\n return result\n}\n\n/**\n * Collects all terminal leaf columns in their current table order.\n *\n * Column ordering features can reorder the collected leaves before the result\n * is returned.\n *\n * @example\n * ```ts\n * const leafColumns = table_getAllLeafColumns(table)\n * ```\n */\nexport function table_getAllLeafColumns<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n): Array<Column<TFeatures, TData, unknown>> {\n const leafColumns = table.getAllColumns().flatMap(\n (c) => c.getLeafColumns(), // recursive\n )\n return callMemoOrStaticFn(\n table,\n 'getOrderColumns',\n table_getOrderColumnsFn,\n )(leafColumns) as Array<Column<TFeatures, TData, unknown>>\n}\n\n/**\n * Builds an id lookup for terminal leaf columns only.\n *\n * Parent/group columns are excluded, making this lookup appropriate for row\n * cells and feature state keyed by data columns.\n *\n * @example\n * ```ts\n * const leavesById = table_getAllLeafColumnsById(table)\n * ```\n */\nexport function table_getAllLeafColumnsById<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n): Record<string, Column<TFeatures, TData, unknown>> {\n const result: Record<string, Column<TFeatures, TData, unknown>> = {}\n const leafColumns = table.getAllLeafColumns()\n for (let i = 0; i < leafColumns.length; i++) {\n const column = leafColumns[i]!\n result[column.id] = column\n }\n return result\n}\n\n/**\n * Looks up a column by id from the flat column map.\n *\n * The lookup can return group columns or leaf columns. In development, a\n * missing id logs a warning to help catch stale column references.\n *\n * @example\n * ```ts\n * const column = table_getColumn(table, 'firstName')\n * ```\n */\nexport function table_getColumn<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n columnId: string,\n): Column<TFeatures, TData, unknown> | undefined {\n const column = table.getAllFlatColumnsById()[columnId]\n\n if (process.env.NODE_ENV === 'development' && !column) {\n console.warn(`[Table] Column with id '${columnId}' does not exist.`)\n }\n\n return column\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAwBA,SAAgB,sBAKd,QACyC;CACzC,OAAO,CAAC,QAAQ,GAAG,OAAO,QAAQ,SAAS,QAAQ,IAAI,eAAe,CAAC,CAAC;AAC1E;;;;;;;;;;;;AAaA,SAAgB,sBAKd,QACyC;CACzC,IAAI,OAAO,QAAQ,QAAQ;EACzB,MAAM,cAAc,OAAO,QAAQ,SAChC,QAAQ,IAAI,eAAe,CAC9B;EAEA,OAAOA,iCACL,OAAO,OACP,mBACAC,2DACF,CAAC,CAAC,WAAkB;CACtB;CAEA,OAAO,CAAC,MAAM;AAChB;;;;;;;;;;;;;AAcA,SAAgB,0BAId,OAC+C;CAC/C,OAAO;EACL,SAAS,UAAU;GACjB,MAAM,oBAAoB,MAAM,OAAO,OACpC;GAEH,IAAI,kBAAkB,aACpB,OAAO,kBAAkB;GAG3B,IAAI,kBAAkB,YACpB,OAAO,kBAAkB;GAG3B,OAAO;EACT;EACA,OAAO,UAAU;;uCAAM,YAAiB,4FAAG,+GAAW,MAAK;EAAG;EAC9D,GAAG,OAAO,OAAO,MAAM,SAAS,CAAC,CAAC,QAAQ,KAAK,YAAY;;GACzD,OAAO,OAAO,OAAO,8BAAK,QAAQ,+GAAsB,CAAC;EAC3D,GAAG,CAAC,CAAC;EACL,GAAG,MAAM,QAAQ;CACnB;AACF;;;;;;;;;;;;AAaA,SAAgB,oBAId,OAC0C;CAC1C,MAAM,kBACJ,SACA,QACA,QAAQ,MACqC;EAC7C,OAAO,QAAQ,KAAK,cAAc;GAChC,MAAM,SAASC,wCAAgB,OAAO,WAAW,OAAO,MAAM;GAE9D,MAAM,oBAAoB;GAM1B,OAAO,UAAU,kBAAkB,UAC/B,eAAe,kBAAkB,SAAS,QAAQ,QAAQ,CAAC,IAC3D,CAAC;GAEL,OAAO;EACT,CAAC;CACH;CAEA,OAAO,eAAe,MAAM,QAAQ,OAAO;AAC7C;;;;;;;;;;;;AAaA,SAAgB,wBAId,OAC0C;CAC1C,OAAO,MAAM,cAAc,CAAC,CAAC,SAAS,WAAW,OAAO,eAAe,CAAC;AAC1E;;;;;;;;;;;;AAaA,SAAgB,4BAId,OACmD;CACnD,MAAM,SAA4D,CAAC;CACnE,MAAM,cAAc,MAAM,kBAAkB;CAC5C,KAAK,IAAI,IAAI,GAAG,IAAI,YAAY,QAAQ,KAAK;EAC3C,MAAM,SAAS,YAAY;EAC3B,OAAO,OAAO,MAAM;CACtB;CACA,OAAO;AACT;;;;;;;;;;;;AAaA,SAAgB,wBAId,OAC0C;CAC1C,MAAM,cAAc,MAAM,cAAc,CAAC,CAAC,SACvC,MAAM,EAAE,eAAe,CAC1B;CACA,OAAOF,iCACL,OACA,mBACAC,2DACF,CAAC,CAAC,WAAW;AACf;;;;;;;;;;;;AAaA,SAAgB,4BAId,OACmD;CACnD,MAAM,SAA4D,CAAC;CACnE,MAAM,cAAc,MAAM,kBAAkB;CAC5C,KAAK,IAAI,IAAI,GAAG,IAAI,YAAY,QAAQ,KAAK;EAC3C,MAAM,SAAS,YAAY;EAC3B,OAAO,OAAO,MAAM;CACtB;CACA,OAAO;AACT;;;;;;;;;;;;AAaA,SAAgB,gBAId,OACA,UAC+C;CAC/C,MAAM,SAAS,MAAM,sBAAsB,CAAC,CAAC;CAE7C,IAAI,QAAQ,IAAI,aAAa,iBAAiB,CAAC,QAC7C,QAAQ,KAAK,2BAA2B,SAAS,kBAAkB;CAGrE,OAAO;AACT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coreColumnsFeature.utils.js","names":[],"sources":["../../../src/core/columns/coreColumnsFeature.utils.ts"],"sourcesContent":["import { callMemoOrStaticFn } from '../../utils'\nimport { table_getOrderColumnsFn } from '../../features/column-ordering/columnOrderingFeature.utils'\nimport { constructColumn } from './constructColumn'\nimport type { Table_Internal } from '../../types/Table'\nimport type { CellData, RowData } from '../../types/type-utils'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type {\n ColumnDef,\n ColumnDefResolved,\n GroupColumnDef,\n} from '../../types/ColumnDef'\nimport type { Column } from '../../types/Column'\n\n/**\n * Flattens this column and every descendant column into a single array.\n *\n * Group columns appear before their child columns, which matches the normalized\n * column hierarchy produced during table construction.\n *\n * @example\n * ```ts\n * const flatColumns = column_getFlatColumns(column)\n * ```\n */\nexport function column_getFlatColumns<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(\n column: Column<TFeatures, TData, TValue>,\n): Array<Column<TFeatures, TData, TValue>> {\n return [column, ...column.columns.flatMap((col) => col.getFlatColumns())]\n}\n\n/**\n * Collects the terminal leaf columns below this column.\n *\n * Group columns return their ordered descendants. Non-group columns return an\n * array containing only the column itself.\n *\n * @example\n * ```ts\n * const leafColumns = column_getLeafColumns(column)\n * ```\n */\nexport function column_getLeafColumns<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(\n column: Column<TFeatures, TData, TValue>,\n): Array<Column<TFeatures, TData, TValue>> {\n if (column.columns.length) {\n const leafColumns = column.columns.flatMap(\n (col) => col.getLeafColumns(), // recursive\n )\n\n return callMemoOrStaticFn(\n column.table,\n 'getOrderColumns',\n table_getOrderColumnsFn,\n )(leafColumns as any) as any\n }\n\n return [column]\n}\n\n/**\n * Merges built-in, feature, and user default column definitions.\n *\n * Built-in defaults provide a header and fallback cell renderer, feature\n * defaults can add feature-specific column options, and\n * `options.defaultColumn` wins last.\n *\n * @example\n * ```ts\n * const defaultColumn = table_getDefaultColumnDef(table)\n * ```\n */\nexport function table_getDefaultColumnDef<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n): Partial<ColumnDef<TFeatures, TData, unknown>> {\n return {\n header: (props) => {\n const resolvedColumnDef = props.header.column\n .columnDef as ColumnDefResolved<{}, TData>\n\n if (resolvedColumnDef.accessorKey) {\n return resolvedColumnDef.accessorKey\n }\n\n if (resolvedColumnDef.accessorFn) {\n return resolvedColumnDef.id\n }\n\n return null\n },\n cell: (props) => props.renderValue<any>()?.toString?.() ?? null,\n ...Object.values(table._features).reduce((obj, feature) => {\n return Object.assign(obj, feature.getDefaultColumnDef?.())\n }, {}),\n ...table.options.defaultColumn,\n } as Partial<ColumnDef<TFeatures, TData, unknown>>\n}\n\n/**\n * Normalizes `options.columns` into the table's nested column tree.\n *\n * Each column definition is constructed with its parent and depth, and group\n * column children are recursively constructed.\n *\n * @example\n * ```ts\n * const columns = table_getAllColumns(table)\n * ```\n */\nexport function table_getAllColumns<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n): Array<Column<TFeatures, TData, unknown>> {\n const recurseColumns = (\n colDefs: ReadonlyArray<ColumnDef<TFeatures, TData, unknown>>,\n parent?: Column<TFeatures, TData, unknown>,\n depth = 0,\n ): Array<Column<TFeatures, TData, unknown>> => {\n return colDefs.map((columnDef) => {\n const column = constructColumn(table, columnDef, depth, parent)\n\n const groupingColumnDef = columnDef as GroupColumnDef<\n TFeatures,\n TData,\n unknown\n >\n\n column.columns = groupingColumnDef.columns\n ? recurseColumns(groupingColumnDef.columns, column, depth + 1)\n : []\n\n return column\n })\n }\n\n return recurseColumns(table.options.columns)\n}\n\n/**\n * Flattens every table column, including group columns and leaf columns.\n *\n * Use this when parent/group columns must be included in addition to data leaf\n * columns.\n *\n * @example\n * ```ts\n * const flatColumns = table_getAllFlatColumns(table)\n * ```\n */\nexport function table_getAllFlatColumns<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n): Array<Column<TFeatures, TData, unknown>> {\n return table.getAllColumns().flatMap((column) => column.getFlatColumns())\n}\n\n/**\n * Builds an id lookup for every flat column in the table.\n *\n * Group columns and leaf columns are included. Later columns with the same id\n * replace earlier entries.\n *\n * @example\n * ```ts\n * const columnsById = table_getAllFlatColumnsById(table)\n * ```\n */\nexport function table_getAllFlatColumnsById<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n): Record<string, Column<TFeatures, TData, unknown>> {\n const result: Record<string, Column<TFeatures, TData, unknown>> = {}\n const flatColumns = table.getAllFlatColumns()\n for (let i = 0; i < flatColumns.length; i++) {\n const column = flatColumns[i]!\n result[column.id] = column\n }\n return result\n}\n\n/**\n * Collects all terminal leaf columns in their current table order.\n *\n * Column ordering features can reorder the collected leaves before the result\n * is returned.\n *\n * @example\n * ```ts\n * const leafColumns = table_getAllLeafColumns(table)\n * ```\n */\nexport function table_getAllLeafColumns<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n): Array<Column<TFeatures, TData, unknown>> {\n const leafColumns = table.getAllColumns().flatMap(\n (c) => c.getLeafColumns(), // recursive\n )\n return callMemoOrStaticFn(\n table,\n 'getOrderColumns',\n table_getOrderColumnsFn,\n )(leafColumns)
|
|
1
|
+
{"version":3,"file":"coreColumnsFeature.utils.js","names":[],"sources":["../../../src/core/columns/coreColumnsFeature.utils.ts"],"sourcesContent":["import { callMemoOrStaticFn } from '../../utils'\nimport { table_getOrderColumnsFn } from '../../features/column-ordering/columnOrderingFeature.utils'\nimport { constructColumn } from './constructColumn'\nimport type { Table_Internal } from '../../types/Table'\nimport type { CellData, RowData } from '../../types/type-utils'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type {\n ColumnDef,\n ColumnDefResolved,\n GroupColumnDef,\n} from '../../types/ColumnDef'\nimport type { Column } from '../../types/Column'\n\n/**\n * Flattens this column and every descendant column into a single array.\n *\n * Group columns appear before their child columns, which matches the normalized\n * column hierarchy produced during table construction.\n *\n * @example\n * ```ts\n * const flatColumns = column_getFlatColumns(column)\n * ```\n */\nexport function column_getFlatColumns<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(\n column: Column<TFeatures, TData, TValue>,\n): Array<Column<TFeatures, TData, TValue>> {\n return [column, ...column.columns.flatMap((col) => col.getFlatColumns())]\n}\n\n/**\n * Collects the terminal leaf columns below this column.\n *\n * Group columns return their ordered descendants. Non-group columns return an\n * array containing only the column itself.\n *\n * @example\n * ```ts\n * const leafColumns = column_getLeafColumns(column)\n * ```\n */\nexport function column_getLeafColumns<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(\n column: Column<TFeatures, TData, TValue>,\n): Array<Column<TFeatures, TData, TValue>> {\n if (column.columns.length) {\n const leafColumns = column.columns.flatMap(\n (col) => col.getLeafColumns(), // recursive\n )\n\n return callMemoOrStaticFn(\n column.table,\n 'getOrderColumns',\n table_getOrderColumnsFn,\n )(leafColumns as any) as any\n }\n\n return [column]\n}\n\n/**\n * Merges built-in, feature, and user default column definitions.\n *\n * Built-in defaults provide a header and fallback cell renderer, feature\n * defaults can add feature-specific column options, and\n * `options.defaultColumn` wins last.\n *\n * @example\n * ```ts\n * const defaultColumn = table_getDefaultColumnDef(table)\n * ```\n */\nexport function table_getDefaultColumnDef<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n): Partial<ColumnDef<TFeatures, TData, unknown>> {\n return {\n header: (props) => {\n const resolvedColumnDef = props.header.column\n .columnDef as ColumnDefResolved<{}, TData>\n\n if (resolvedColumnDef.accessorKey) {\n return resolvedColumnDef.accessorKey\n }\n\n if (resolvedColumnDef.accessorFn) {\n return resolvedColumnDef.id\n }\n\n return null\n },\n cell: (props) => props.renderValue<any>()?.toString?.() ?? null,\n ...Object.values(table._features).reduce((obj, feature) => {\n return Object.assign(obj, feature.getDefaultColumnDef?.())\n }, {}),\n ...table.options.defaultColumn,\n } as Partial<ColumnDef<TFeatures, TData, unknown>>\n}\n\n/**\n * Normalizes `options.columns` into the table's nested column tree.\n *\n * Each column definition is constructed with its parent and depth, and group\n * column children are recursively constructed.\n *\n * @example\n * ```ts\n * const columns = table_getAllColumns(table)\n * ```\n */\nexport function table_getAllColumns<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n): Array<Column<TFeatures, TData, unknown>> {\n const recurseColumns = (\n colDefs: ReadonlyArray<ColumnDef<TFeatures, TData, unknown>>,\n parent?: Column<TFeatures, TData, unknown>,\n depth = 0,\n ): Array<Column<TFeatures, TData, unknown>> => {\n return colDefs.map((columnDef) => {\n const column = constructColumn(table, columnDef, depth, parent)\n\n const groupingColumnDef = columnDef as GroupColumnDef<\n TFeatures,\n TData,\n unknown\n >\n\n column.columns = groupingColumnDef.columns\n ? recurseColumns(groupingColumnDef.columns, column, depth + 1)\n : []\n\n return column\n })\n }\n\n return recurseColumns(table.options.columns)\n}\n\n/**\n * Flattens every table column, including group columns and leaf columns.\n *\n * Use this when parent/group columns must be included in addition to data leaf\n * columns.\n *\n * @example\n * ```ts\n * const flatColumns = table_getAllFlatColumns(table)\n * ```\n */\nexport function table_getAllFlatColumns<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n): Array<Column<TFeatures, TData, unknown>> {\n return table.getAllColumns().flatMap((column) => column.getFlatColumns())\n}\n\n/**\n * Builds an id lookup for every flat column in the table.\n *\n * Group columns and leaf columns are included. Later columns with the same id\n * replace earlier entries.\n *\n * @example\n * ```ts\n * const columnsById = table_getAllFlatColumnsById(table)\n * ```\n */\nexport function table_getAllFlatColumnsById<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n): Record<string, Column<TFeatures, TData, unknown>> {\n const result: Record<string, Column<TFeatures, TData, unknown>> = {}\n const flatColumns = table.getAllFlatColumns()\n for (let i = 0; i < flatColumns.length; i++) {\n const column = flatColumns[i]!\n result[column.id] = column\n }\n return result\n}\n\n/**\n * Collects all terminal leaf columns in their current table order.\n *\n * Column ordering features can reorder the collected leaves before the result\n * is returned.\n *\n * @example\n * ```ts\n * const leafColumns = table_getAllLeafColumns(table)\n * ```\n */\nexport function table_getAllLeafColumns<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n): Array<Column<TFeatures, TData, unknown>> {\n const leafColumns = table.getAllColumns().flatMap(\n (c) => c.getLeafColumns(), // recursive\n )\n return callMemoOrStaticFn(\n table,\n 'getOrderColumns',\n table_getOrderColumnsFn,\n )(leafColumns) as Array<Column<TFeatures, TData, unknown>>\n}\n\n/**\n * Builds an id lookup for terminal leaf columns only.\n *\n * Parent/group columns are excluded, making this lookup appropriate for row\n * cells and feature state keyed by data columns.\n *\n * @example\n * ```ts\n * const leavesById = table_getAllLeafColumnsById(table)\n * ```\n */\nexport function table_getAllLeafColumnsById<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n): Record<string, Column<TFeatures, TData, unknown>> {\n const result: Record<string, Column<TFeatures, TData, unknown>> = {}\n const leafColumns = table.getAllLeafColumns()\n for (let i = 0; i < leafColumns.length; i++) {\n const column = leafColumns[i]!\n result[column.id] = column\n }\n return result\n}\n\n/**\n * Looks up a column by id from the flat column map.\n *\n * The lookup can return group columns or leaf columns. In development, a\n * missing id logs a warning to help catch stale column references.\n *\n * @example\n * ```ts\n * const column = table_getColumn(table, 'firstName')\n * ```\n */\nexport function table_getColumn<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n columnId: string,\n): Column<TFeatures, TData, unknown> | undefined {\n const column = table.getAllFlatColumnsById()[columnId]\n\n if (process.env.NODE_ENV === 'development' && !column) {\n console.warn(`[Table] Column with id '${columnId}' does not exist.`)\n }\n\n return column\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAwBA,SAAgB,sBAKd,QACyC;CACzC,OAAO,CAAC,QAAQ,GAAG,OAAO,QAAQ,SAAS,QAAQ,IAAI,eAAe,CAAC,CAAC;AAC1E;;;;;;;;;;;;AAaA,SAAgB,sBAKd,QACyC;CACzC,IAAI,OAAO,QAAQ,QAAQ;EACzB,MAAM,cAAc,OAAO,QAAQ,SAChC,QAAQ,IAAI,eAAe,CAC9B;EAEA,OAAO,mBACL,OAAO,OACP,mBACA,uBACF,CAAC,CAAC,WAAkB;CACtB;CAEA,OAAO,CAAC,MAAM;AAChB;;;;;;;;;;;;;AAcA,SAAgB,0BAId,OAC+C;CAC/C,OAAO;EACL,SAAS,UAAU;GACjB,MAAM,oBAAoB,MAAM,OAAO,OACpC;GAEH,IAAI,kBAAkB,aACpB,OAAO,kBAAkB;GAG3B,IAAI,kBAAkB,YACpB,OAAO,kBAAkB;GAG3B,OAAO;EACT;EACA,OAAO,UAAU;;uCAAM,YAAiB,4FAAG,+GAAW,MAAK;EAAG;EAC9D,GAAG,OAAO,OAAO,MAAM,SAAS,CAAC,CAAC,QAAQ,KAAK,YAAY;;GACzD,OAAO,OAAO,OAAO,8BAAK,QAAQ,+GAAsB,CAAC;EAC3D,GAAG,CAAC,CAAC;EACL,GAAG,MAAM,QAAQ;CACnB;AACF;;;;;;;;;;;;AAaA,SAAgB,oBAId,OAC0C;CAC1C,MAAM,kBACJ,SACA,QACA,QAAQ,MACqC;EAC7C,OAAO,QAAQ,KAAK,cAAc;GAChC,MAAM,SAAS,gBAAgB,OAAO,WAAW,OAAO,MAAM;GAE9D,MAAM,oBAAoB;GAM1B,OAAO,UAAU,kBAAkB,UAC/B,eAAe,kBAAkB,SAAS,QAAQ,QAAQ,CAAC,IAC3D,CAAC;GAEL,OAAO;EACT,CAAC;CACH;CAEA,OAAO,eAAe,MAAM,QAAQ,OAAO;AAC7C;;;;;;;;;;;;AAaA,SAAgB,wBAId,OAC0C;CAC1C,OAAO,MAAM,cAAc,CAAC,CAAC,SAAS,WAAW,OAAO,eAAe,CAAC;AAC1E;;;;;;;;;;;;AAaA,SAAgB,4BAId,OACmD;CACnD,MAAM,SAA4D,CAAC;CACnE,MAAM,cAAc,MAAM,kBAAkB;CAC5C,KAAK,IAAI,IAAI,GAAG,IAAI,YAAY,QAAQ,KAAK;EAC3C,MAAM,SAAS,YAAY;EAC3B,OAAO,OAAO,MAAM;CACtB;CACA,OAAO;AACT;;;;;;;;;;;;AAaA,SAAgB,wBAId,OAC0C;CAC1C,MAAM,cAAc,MAAM,cAAc,CAAC,CAAC,SACvC,MAAM,EAAE,eAAe,CAC1B;CACA,OAAO,mBACL,OACA,mBACA,uBACF,CAAC,CAAC,WAAW;AACf;;;;;;;;;;;;AAaA,SAAgB,4BAId,OACmD;CACnD,MAAM,SAA4D,CAAC;CACnE,MAAM,cAAc,MAAM,kBAAkB;CAC5C,KAAK,IAAI,IAAI,GAAG,IAAI,YAAY,QAAQ,KAAK;EAC3C,MAAM,SAAS,YAAY;EAC3B,OAAO,OAAO,MAAM;CACtB;CACA,OAAO;AACT;;;;;;;;;;;;AAaA,SAAgB,gBAId,OACA,UAC+C;CAC/C,MAAM,SAAS,MAAM,sBAAsB,CAAC,CAAC;CAE7C,IAAI,QAAQ,IAAI,aAAa,iBAAiB,CAAC,QAC7C,QAAQ,KAAK,2BAA2B,SAAS,kBAAkB;CAGrE,OAAO;AACT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildHeaderGroups.cjs","names":["callMemoOrStaticFn","column_getIsVisible","constructHeader"],"sources":["../../../src/core/headers/buildHeaderGroups.ts"],"sourcesContent":["import { callMemoOrStaticFn } from '../../utils'\nimport { column_getIsVisible } from '../../features/column-visibility/columnVisibilityFeature.utils'\nimport { constructHeader } from './constructHeader'\nimport type { Table_Internal } from '../../types/Table'\nimport type { CellData, RowData } from '../../types/type-utils'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { Header } from '../../types/Header'\nimport type { HeaderGroup } from '../../types/HeaderGroup'\nimport type { Column } from '../../types/Column'\n\n/**\n * Builds the nested header group structure for a table.\n *\n * The result accounts for visible leaf columns, pinned column groups, and placeholder headers needed to render multi-level headers.\n */\nexport function buildHeaderGroups<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(\n allColumns: Array<Column<TFeatures, TData, TValue>>,\n columnsToGroup: Array<Column<TFeatures, TData, TValue>>,\n table: Table_Internal<TFeatures, TData>,\n headerFamily?: 'center' | 'left' | 'right',\n) {\n // Find the max depth of the columns:\n // build the leaf column row\n // build each buffer row going up\n // placeholder for non-existent level\n // real column for existing level\n\n let maxDepth = 0\n\n const findMaxDepth = (\n columns: Array<Column<TFeatures, TData, TValue>>,\n depth = 1,\n ) => {\n maxDepth = Math.max(maxDepth, depth)\n\n for (let i = 0; i < columns.length; i++) {\n const column = columns[i]!\n if (callMemoOrStaticFn(column, 'getIsVisible', column_getIsVisible)) {\n if (column.columns.length) {\n findMaxDepth(column.columns, depth + 1)\n }\n }\n }\n }\n\n findMaxDepth(allColumns)\n\n const headerGroups: Array<HeaderGroup<TFeatures, TData>> = []\n\n const constructHeaderGroup = (\n headersToGroup: Array<Header<TFeatures, TData, TValue>>,\n depth: number,\n ) => {\n // The header group we are creating\n const headerGroup: HeaderGroup<TFeatures, TData> = {\n depth,\n id: [headerFamily, `${depth}`].filter(Boolean).join('_'),\n headers: [],\n }\n\n // The parent columns we're going to scan next\n const pendingParentHeaders: Array<Header<TFeatures, TData, TValue>> = []\n\n // Scan each column for parents\n headersToGroup.forEach((headerToGroup) => {\n // What is the latest (last) parent column?\n\n const latestPendingParentHeader =\n pendingParentHeaders[pendingParentHeaders.length - 1]\n\n const isLeafHeader = headerToGroup.column.depth === headerGroup.depth\n\n let column: Column<TFeatures, TData, TValue>\n let isPlaceholder = false\n\n if (isLeafHeader && headerToGroup.column.parent) {\n // The parent header is new\n column = headerToGroup.column.parent\n } else {\n // The parent header is repeated\n column = headerToGroup.column\n isPlaceholder = true\n }\n\n if (\n latestPendingParentHeader &&\n latestPendingParentHeader.column === column\n ) {\n // This column is repeated. Add it as a sub header to the next batch\n latestPendingParentHeader.subHeaders.push(headerToGroup)\n } else {\n // This is a new header. Let's create it\n const header = constructHeader(table, column, {\n id: [headerFamily, depth, column.id, headerToGroup.id]\n .filter(Boolean)\n .join('_'),\n isPlaceholder,\n placeholderId: isPlaceholder\n ? `${pendingParentHeaders.filter((d) => d.column === column).length}`\n : undefined,\n depth,\n index: pendingParentHeaders.length,\n })\n\n // Add the headerToGroup as a subHeader of the new header\n header.subHeaders.push(headerToGroup)\n // Add the new header to the pendingParentHeaders to get grouped\n // in the next batch\n pendingParentHeaders.push(header)\n }\n\n headerGroup.headers.push(headerToGroup)\n headerToGroup.headerGroup = headerGroup\n })\n\n headerGroups.push(headerGroup)\n\n if (depth > 0) {\n constructHeaderGroup(pendingParentHeaders, depth - 1)\n }\n }\n\n const bottomHeaders = columnsToGroup.map((column, index) =>\n constructHeader(table, column, {\n depth: maxDepth,\n index,\n }),\n )\n\n constructHeaderGroup(bottomHeaders, maxDepth - 1)\n\n headerGroups.reverse()\n\n const recurseHeadersForSpans = (\n headers: Array<Header<TFeatures, TData, TValue>>,\n ): Array<{ colSpan: number; rowSpan: number }> => {\n const results: Array<{ colSpan: number; rowSpan: number }> = []\n\n for (let i = 0; i < headers.length; i++) {\n const header = headers[i]!\n if (\n !callMemoOrStaticFn(header.column, 'getIsVisible', column_getIsVisible)\n ) {\n continue\n }\n\n let colSpan = 0\n let minChildRowSpan = Infinity\n\n if (header.subHeaders.length) {\n const childSpans = recurseHeadersForSpans(header.subHeaders)\n for (let j = 0; j < childSpans.length; j++) {\n const child = childSpans[j]!\n colSpan += child.colSpan\n if (child.rowSpan < minChildRowSpan) {\n minChildRowSpan = child.rowSpan\n }\n }\n } else {\n colSpan = 1\n minChildRowSpan = 0\n }\n\n header.colSpan = colSpan\n header.rowSpan = minChildRowSpan\n\n results.push({ colSpan, rowSpan: header.rowSpan })\n }\n\n return results\n }\n\n recurseHeadersForSpans(\n (headerGroups[0]?.headers ?? []) as Array<Header<TFeatures, TData, TValue>>,\n )\n\n return headerGroups\n}\n"],"mappings":";;;;;;;;;;AAeA,SAAgB,kBAKd,YACA,gBACA,OACA,cACA;;CAOA,IAAI,WAAW;CAEf,MAAM,gBACJ,SACA,QAAQ,MACL;EACH,WAAW,KAAK,IAAI,UAAU,KAAK;EAEnC,KAAK,IAAI,IAAI,GAAG,IAAI,QAAQ,QAAQ,KAAK;GACvC,MAAM,SAAS,QAAQ;GACvB,IAAIA,iCAAmB,QAAQ,gBAAgBC,yDAAmB,GAChE;QAAI,OAAO,QAAQ,QACjB,aAAa,OAAO,SAAS,QAAQ,CAAC;GACxC;EAEJ;CACF;CAEA,aAAa,UAAU;CAEvB,MAAM,eAAqD,CAAC;CAE5D,MAAM,wBACJ,gBACA,UACG;EAEH,MAAM,cAA6C;GACjD;GACA,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG;GACvD,SAAS,CAAC;EACZ;EAGA,MAAM,uBAAgE,CAAC;EAGvE,eAAe,SAAS,kBAAkB;GAGxC,MAAM,4BACJ,qBAAqB,qBAAqB,SAAS;GAErD,MAAM,eAAe,cAAc,OAAO,UAAU,YAAY;GAEhE,IAAI;GACJ,IAAI,gBAAgB;GAEpB,IAAI,gBAAgB,cAAc,OAAO,QAEvC,SAAS,cAAc,OAAO;QACzB;IAEL,SAAS,cAAc;IACvB,gBAAgB;GAClB;GAEA,IACE,6BACA,0BAA0B,WAAW,QAGrC,0BAA0B,WAAW,KAAK,aAAa;QAClD;IAEL,MAAM,SAASC,wCAAgB,OAAO,QAAQ;KAC5C,IAAI;MAAC;MAAc;MAAO,OAAO;MAAI,cAAc;KAAE,CAAC,CACnD,OAAO,OAAO,CAAC,CACf,KAAK,GAAG;KACX;KACA,eAAe,gBACX,GAAG,qBAAqB,QAAQ,MAAM,EAAE,WAAW,MAAM,CAAC,CAAC,WAC3D;KACJ;KACA,OAAO,qBAAqB;IAC9B,CAAC;IAGD,OAAO,WAAW,KAAK,aAAa;IAGpC,qBAAqB,KAAK,MAAM;GAClC;GAEA,YAAY,QAAQ,
|
|
1
|
+
{"version":3,"file":"buildHeaderGroups.cjs","names":["callMemoOrStaticFn","column_getIsVisible","constructHeader"],"sources":["../../../src/core/headers/buildHeaderGroups.ts"],"sourcesContent":["import { callMemoOrStaticFn } from '../../utils'\nimport { column_getIsVisible } from '../../features/column-visibility/columnVisibilityFeature.utils'\nimport { constructHeader } from './constructHeader'\nimport type { Table_Internal } from '../../types/Table'\nimport type { CellData, RowData } from '../../types/type-utils'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { Header } from '../../types/Header'\nimport type { HeaderGroup } from '../../types/HeaderGroup'\nimport type { Column } from '../../types/Column'\n\n/**\n * Builds the nested header group structure for a table.\n *\n * The result accounts for visible leaf columns, pinned column groups, and placeholder headers needed to render multi-level headers.\n */\nexport function buildHeaderGroups<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(\n allColumns: Array<Column<TFeatures, TData, TValue>>,\n columnsToGroup: Array<Column<TFeatures, TData, TValue>>,\n table: Table_Internal<TFeatures, TData>,\n headerFamily?: 'center' | 'left' | 'right',\n) {\n // Find the max depth of the columns:\n // build the leaf column row\n // build each buffer row going up\n // placeholder for non-existent level\n // real column for existing level\n\n let maxDepth = 0\n\n const findMaxDepth = (\n columns: Array<Column<TFeatures, TData, TValue>>,\n depth = 1,\n ) => {\n maxDepth = Math.max(maxDepth, depth)\n\n for (let i = 0; i < columns.length; i++) {\n const column = columns[i]!\n if (callMemoOrStaticFn(column, 'getIsVisible', column_getIsVisible)) {\n if (column.columns.length) {\n findMaxDepth(column.columns, depth + 1)\n }\n }\n }\n }\n\n findMaxDepth(allColumns)\n\n const headerGroups: Array<HeaderGroup<TFeatures, TData>> = []\n\n const constructHeaderGroup = (\n headersToGroup: Array<Header<TFeatures, TData, TValue>>,\n depth: number,\n ) => {\n // The header group we are creating\n const headerGroup: HeaderGroup<TFeatures, TData> = {\n depth,\n id: [headerFamily, `${depth}`].filter(Boolean).join('_'),\n headers: [],\n }\n\n // The parent columns we're going to scan next\n const pendingParentHeaders: Array<Header<TFeatures, TData, TValue>> = []\n\n // Scan each column for parents\n headersToGroup.forEach((headerToGroup) => {\n // What is the latest (last) parent column?\n\n const latestPendingParentHeader =\n pendingParentHeaders[pendingParentHeaders.length - 1]\n\n const isLeafHeader = headerToGroup.column.depth === headerGroup.depth\n\n let column: Column<TFeatures, TData, TValue>\n let isPlaceholder = false\n\n if (isLeafHeader && headerToGroup.column.parent) {\n // The parent header is new\n column = headerToGroup.column.parent\n } else {\n // The parent header is repeated\n column = headerToGroup.column\n isPlaceholder = true\n }\n\n if (\n latestPendingParentHeader &&\n latestPendingParentHeader.column === column\n ) {\n // This column is repeated. Add it as a sub header to the next batch\n latestPendingParentHeader.subHeaders.push(headerToGroup)\n } else {\n // This is a new header. Let's create it\n const header = constructHeader(table, column, {\n id: [headerFamily, depth, column.id, headerToGroup.id]\n .filter(Boolean)\n .join('_'),\n isPlaceholder,\n placeholderId: isPlaceholder\n ? `${pendingParentHeaders.filter((d) => d.column === column).length}`\n : undefined,\n depth,\n index: pendingParentHeaders.length,\n })\n\n // Add the headerToGroup as a subHeader of the new header\n header.subHeaders.push(headerToGroup)\n // Add the new header to the pendingParentHeaders to get grouped\n // in the next batch\n pendingParentHeaders.push(header)\n }\n\n headerGroup.headers.push(\n headerToGroup as Header<TFeatures, TData, unknown>,\n )\n headerToGroup.headerGroup = headerGroup\n })\n\n headerGroups.push(headerGroup)\n\n if (depth > 0) {\n constructHeaderGroup(pendingParentHeaders, depth - 1)\n }\n }\n\n const bottomHeaders = columnsToGroup.map((column, index) =>\n constructHeader(table, column, {\n depth: maxDepth,\n index,\n }),\n )\n\n constructHeaderGroup(bottomHeaders, maxDepth - 1)\n\n headerGroups.reverse()\n\n const recurseHeadersForSpans = (\n headers: Array<Header<TFeatures, TData, TValue>>,\n ): Array<{ colSpan: number; rowSpan: number }> => {\n const results: Array<{ colSpan: number; rowSpan: number }> = []\n\n for (let i = 0; i < headers.length; i++) {\n const header = headers[i]!\n if (\n !callMemoOrStaticFn(header.column, 'getIsVisible', column_getIsVisible)\n ) {\n continue\n }\n\n let colSpan = 0\n let minChildRowSpan = Infinity\n\n if (header.subHeaders.length) {\n const childSpans = recurseHeadersForSpans(header.subHeaders)\n for (let j = 0; j < childSpans.length; j++) {\n const child = childSpans[j]!\n colSpan += child.colSpan\n if (child.rowSpan < minChildRowSpan) {\n minChildRowSpan = child.rowSpan\n }\n }\n } else {\n colSpan = 1\n minChildRowSpan = 0\n }\n\n header.colSpan = colSpan\n header.rowSpan = minChildRowSpan\n\n results.push({ colSpan, rowSpan: header.rowSpan })\n }\n\n return results\n }\n\n recurseHeadersForSpans(\n (headerGroups[0]?.headers ?? []) as Array<Header<TFeatures, TData, TValue>>,\n )\n\n return headerGroups\n}\n"],"mappings":";;;;;;;;;;AAeA,SAAgB,kBAKd,YACA,gBACA,OACA,cACA;;CAOA,IAAI,WAAW;CAEf,MAAM,gBACJ,SACA,QAAQ,MACL;EACH,WAAW,KAAK,IAAI,UAAU,KAAK;EAEnC,KAAK,IAAI,IAAI,GAAG,IAAI,QAAQ,QAAQ,KAAK;GACvC,MAAM,SAAS,QAAQ;GACvB,IAAIA,iCAAmB,QAAQ,gBAAgBC,yDAAmB,GAChE;QAAI,OAAO,QAAQ,QACjB,aAAa,OAAO,SAAS,QAAQ,CAAC;GACxC;EAEJ;CACF;CAEA,aAAa,UAAU;CAEvB,MAAM,eAAqD,CAAC;CAE5D,MAAM,wBACJ,gBACA,UACG;EAEH,MAAM,cAA6C;GACjD;GACA,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG;GACvD,SAAS,CAAC;EACZ;EAGA,MAAM,uBAAgE,CAAC;EAGvE,eAAe,SAAS,kBAAkB;GAGxC,MAAM,4BACJ,qBAAqB,qBAAqB,SAAS;GAErD,MAAM,eAAe,cAAc,OAAO,UAAU,YAAY;GAEhE,IAAI;GACJ,IAAI,gBAAgB;GAEpB,IAAI,gBAAgB,cAAc,OAAO,QAEvC,SAAS,cAAc,OAAO;QACzB;IAEL,SAAS,cAAc;IACvB,gBAAgB;GAClB;GAEA,IACE,6BACA,0BAA0B,WAAW,QAGrC,0BAA0B,WAAW,KAAK,aAAa;QAClD;IAEL,MAAM,SAASC,wCAAgB,OAAO,QAAQ;KAC5C,IAAI;MAAC;MAAc;MAAO,OAAO;MAAI,cAAc;KAAE,CAAC,CACnD,OAAO,OAAO,CAAC,CACf,KAAK,GAAG;KACX;KACA,eAAe,gBACX,GAAG,qBAAqB,QAAQ,MAAM,EAAE,WAAW,MAAM,CAAC,CAAC,WAC3D;KACJ;KACA,OAAO,qBAAqB;IAC9B,CAAC;IAGD,OAAO,WAAW,KAAK,aAAa;IAGpC,qBAAqB,KAAK,MAAM;GAClC;GAEA,YAAY,QAAQ,KAClB,aACF;GACA,cAAc,cAAc;EAC9B,CAAC;EAED,aAAa,KAAK,WAAW;EAE7B,IAAI,QAAQ,GACV,qBAAqB,sBAAsB,QAAQ,CAAC;CAExD;CASA,qBAPsB,eAAe,KAAK,QAAQ,UAChDA,wCAAgB,OAAO,QAAQ;EAC7B,OAAO;EACP;CACF,CAAC,CAG8B,GAAG,WAAW,CAAC;CAEhD,aAAa,QAAQ;CAErB,MAAM,0BACJ,YACgD;EAChD,MAAM,UAAuD,CAAC;EAE9D,KAAK,IAAI,IAAI,GAAG,IAAI,QAAQ,QAAQ,KAAK;GACvC,MAAM,SAAS,QAAQ;GACvB,IACE,CAACF,iCAAmB,OAAO,QAAQ,gBAAgBC,yDAAmB,GAEtE;GAGF,IAAI,UAAU;GACd,IAAI,kBAAkB;GAEtB,IAAI,OAAO,WAAW,QAAQ;IAC5B,MAAM,aAAa,uBAAuB,OAAO,UAAU;IAC3D,KAAK,IAAI,IAAI,GAAG,IAAI,WAAW,QAAQ,KAAK;KAC1C,MAAM,QAAQ,WAAW;KACzB,WAAW,MAAM;KACjB,IAAI,MAAM,UAAU,iBAClB,kBAAkB,MAAM;IAE5B;GACF,OAAO;IACL,UAAU;IACV,kBAAkB;GACpB;GAEA,OAAO,UAAU;GACjB,OAAO,UAAU;GAEjB,QAAQ,KAAK;IAAE;IAAS,SAAS,OAAO;GAAQ,CAAC;EACnD;EAEA,OAAO;CACT;CAEA,0CACG,aAAa,oEAAI,YAAW,CAAC,CAChC;CAEA,OAAO;AACT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildHeaderGroups.js","names":[],"sources":["../../../src/core/headers/buildHeaderGroups.ts"],"sourcesContent":["import { callMemoOrStaticFn } from '../../utils'\nimport { column_getIsVisible } from '../../features/column-visibility/columnVisibilityFeature.utils'\nimport { constructHeader } from './constructHeader'\nimport type { Table_Internal } from '../../types/Table'\nimport type { CellData, RowData } from '../../types/type-utils'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { Header } from '../../types/Header'\nimport type { HeaderGroup } from '../../types/HeaderGroup'\nimport type { Column } from '../../types/Column'\n\n/**\n * Builds the nested header group structure for a table.\n *\n * The result accounts for visible leaf columns, pinned column groups, and placeholder headers needed to render multi-level headers.\n */\nexport function buildHeaderGroups<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(\n allColumns: Array<Column<TFeatures, TData, TValue>>,\n columnsToGroup: Array<Column<TFeatures, TData, TValue>>,\n table: Table_Internal<TFeatures, TData>,\n headerFamily?: 'center' | 'left' | 'right',\n) {\n // Find the max depth of the columns:\n // build the leaf column row\n // build each buffer row going up\n // placeholder for non-existent level\n // real column for existing level\n\n let maxDepth = 0\n\n const findMaxDepth = (\n columns: Array<Column<TFeatures, TData, TValue>>,\n depth = 1,\n ) => {\n maxDepth = Math.max(maxDepth, depth)\n\n for (let i = 0; i < columns.length; i++) {\n const column = columns[i]!\n if (callMemoOrStaticFn(column, 'getIsVisible', column_getIsVisible)) {\n if (column.columns.length) {\n findMaxDepth(column.columns, depth + 1)\n }\n }\n }\n }\n\n findMaxDepth(allColumns)\n\n const headerGroups: Array<HeaderGroup<TFeatures, TData>> = []\n\n const constructHeaderGroup = (\n headersToGroup: Array<Header<TFeatures, TData, TValue>>,\n depth: number,\n ) => {\n // The header group we are creating\n const headerGroup: HeaderGroup<TFeatures, TData> = {\n depth,\n id: [headerFamily, `${depth}`].filter(Boolean).join('_'),\n headers: [],\n }\n\n // The parent columns we're going to scan next\n const pendingParentHeaders: Array<Header<TFeatures, TData, TValue>> = []\n\n // Scan each column for parents\n headersToGroup.forEach((headerToGroup) => {\n // What is the latest (last) parent column?\n\n const latestPendingParentHeader =\n pendingParentHeaders[pendingParentHeaders.length - 1]\n\n const isLeafHeader = headerToGroup.column.depth === headerGroup.depth\n\n let column: Column<TFeatures, TData, TValue>\n let isPlaceholder = false\n\n if (isLeafHeader && headerToGroup.column.parent) {\n // The parent header is new\n column = headerToGroup.column.parent\n } else {\n // The parent header is repeated\n column = headerToGroup.column\n isPlaceholder = true\n }\n\n if (\n latestPendingParentHeader &&\n latestPendingParentHeader.column === column\n ) {\n // This column is repeated. Add it as a sub header to the next batch\n latestPendingParentHeader.subHeaders.push(headerToGroup)\n } else {\n // This is a new header. Let's create it\n const header = constructHeader(table, column, {\n id: [headerFamily, depth, column.id, headerToGroup.id]\n .filter(Boolean)\n .join('_'),\n isPlaceholder,\n placeholderId: isPlaceholder\n ? `${pendingParentHeaders.filter((d) => d.column === column).length}`\n : undefined,\n depth,\n index: pendingParentHeaders.length,\n })\n\n // Add the headerToGroup as a subHeader of the new header\n header.subHeaders.push(headerToGroup)\n // Add the new header to the pendingParentHeaders to get grouped\n // in the next batch\n pendingParentHeaders.push(header)\n }\n\n headerGroup.headers.push(headerToGroup)\n headerToGroup.headerGroup = headerGroup\n })\n\n headerGroups.push(headerGroup)\n\n if (depth > 0) {\n constructHeaderGroup(pendingParentHeaders, depth - 1)\n }\n }\n\n const bottomHeaders = columnsToGroup.map((column, index) =>\n constructHeader(table, column, {\n depth: maxDepth,\n index,\n }),\n )\n\n constructHeaderGroup(bottomHeaders, maxDepth - 1)\n\n headerGroups.reverse()\n\n const recurseHeadersForSpans = (\n headers: Array<Header<TFeatures, TData, TValue>>,\n ): Array<{ colSpan: number; rowSpan: number }> => {\n const results: Array<{ colSpan: number; rowSpan: number }> = []\n\n for (let i = 0; i < headers.length; i++) {\n const header = headers[i]!\n if (\n !callMemoOrStaticFn(header.column, 'getIsVisible', column_getIsVisible)\n ) {\n continue\n }\n\n let colSpan = 0\n let minChildRowSpan = Infinity\n\n if (header.subHeaders.length) {\n const childSpans = recurseHeadersForSpans(header.subHeaders)\n for (let j = 0; j < childSpans.length; j++) {\n const child = childSpans[j]!\n colSpan += child.colSpan\n if (child.rowSpan < minChildRowSpan) {\n minChildRowSpan = child.rowSpan\n }\n }\n } else {\n colSpan = 1\n minChildRowSpan = 0\n }\n\n header.colSpan = colSpan\n header.rowSpan = minChildRowSpan\n\n results.push({ colSpan, rowSpan: header.rowSpan })\n }\n\n return results\n }\n\n recurseHeadersForSpans(\n (headerGroups[0]?.headers ?? []) as Array<Header<TFeatures, TData, TValue>>,\n )\n\n return headerGroups\n}\n"],"mappings":";;;;;;;;;;AAeA,SAAgB,kBAKd,YACA,gBACA,OACA,cACA;;CAOA,IAAI,WAAW;CAEf,MAAM,gBACJ,SACA,QAAQ,MACL;EACH,WAAW,KAAK,IAAI,UAAU,KAAK;EAEnC,KAAK,IAAI,IAAI,GAAG,IAAI,QAAQ,QAAQ,KAAK;GACvC,MAAM,SAAS,QAAQ;GACvB,IAAI,mBAAmB,QAAQ,gBAAgB,mBAAmB,GAChE;QAAI,OAAO,QAAQ,QACjB,aAAa,OAAO,SAAS,QAAQ,CAAC;GACxC;EAEJ;CACF;CAEA,aAAa,UAAU;CAEvB,MAAM,eAAqD,CAAC;CAE5D,MAAM,wBACJ,gBACA,UACG;EAEH,MAAM,cAA6C;GACjD;GACA,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG;GACvD,SAAS,CAAC;EACZ;EAGA,MAAM,uBAAgE,CAAC;EAGvE,eAAe,SAAS,kBAAkB;GAGxC,MAAM,4BACJ,qBAAqB,qBAAqB,SAAS;GAErD,MAAM,eAAe,cAAc,OAAO,UAAU,YAAY;GAEhE,IAAI;GACJ,IAAI,gBAAgB;GAEpB,IAAI,gBAAgB,cAAc,OAAO,QAEvC,SAAS,cAAc,OAAO;QACzB;IAEL,SAAS,cAAc;IACvB,gBAAgB;GAClB;GAEA,IACE,6BACA,0BAA0B,WAAW,QAGrC,0BAA0B,WAAW,KAAK,aAAa;QAClD;IAEL,MAAM,SAAS,gBAAgB,OAAO,QAAQ;KAC5C,IAAI;MAAC;MAAc;MAAO,OAAO;MAAI,cAAc;KAAE,CAAC,CACnD,OAAO,OAAO,CAAC,CACf,KAAK,GAAG;KACX;KACA,eAAe,gBACX,GAAG,qBAAqB,QAAQ,MAAM,EAAE,WAAW,MAAM,CAAC,CAAC,WAC3D;KACJ;KACA,OAAO,qBAAqB;IAC9B,CAAC;IAGD,OAAO,WAAW,KAAK,aAAa;IAGpC,qBAAqB,KAAK,MAAM;GAClC;GAEA,YAAY,QAAQ,
|
|
1
|
+
{"version":3,"file":"buildHeaderGroups.js","names":[],"sources":["../../../src/core/headers/buildHeaderGroups.ts"],"sourcesContent":["import { callMemoOrStaticFn } from '../../utils'\nimport { column_getIsVisible } from '../../features/column-visibility/columnVisibilityFeature.utils'\nimport { constructHeader } from './constructHeader'\nimport type { Table_Internal } from '../../types/Table'\nimport type { CellData, RowData } from '../../types/type-utils'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { Header } from '../../types/Header'\nimport type { HeaderGroup } from '../../types/HeaderGroup'\nimport type { Column } from '../../types/Column'\n\n/**\n * Builds the nested header group structure for a table.\n *\n * The result accounts for visible leaf columns, pinned column groups, and placeholder headers needed to render multi-level headers.\n */\nexport function buildHeaderGroups<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(\n allColumns: Array<Column<TFeatures, TData, TValue>>,\n columnsToGroup: Array<Column<TFeatures, TData, TValue>>,\n table: Table_Internal<TFeatures, TData>,\n headerFamily?: 'center' | 'left' | 'right',\n) {\n // Find the max depth of the columns:\n // build the leaf column row\n // build each buffer row going up\n // placeholder for non-existent level\n // real column for existing level\n\n let maxDepth = 0\n\n const findMaxDepth = (\n columns: Array<Column<TFeatures, TData, TValue>>,\n depth = 1,\n ) => {\n maxDepth = Math.max(maxDepth, depth)\n\n for (let i = 0; i < columns.length; i++) {\n const column = columns[i]!\n if (callMemoOrStaticFn(column, 'getIsVisible', column_getIsVisible)) {\n if (column.columns.length) {\n findMaxDepth(column.columns, depth + 1)\n }\n }\n }\n }\n\n findMaxDepth(allColumns)\n\n const headerGroups: Array<HeaderGroup<TFeatures, TData>> = []\n\n const constructHeaderGroup = (\n headersToGroup: Array<Header<TFeatures, TData, TValue>>,\n depth: number,\n ) => {\n // The header group we are creating\n const headerGroup: HeaderGroup<TFeatures, TData> = {\n depth,\n id: [headerFamily, `${depth}`].filter(Boolean).join('_'),\n headers: [],\n }\n\n // The parent columns we're going to scan next\n const pendingParentHeaders: Array<Header<TFeatures, TData, TValue>> = []\n\n // Scan each column for parents\n headersToGroup.forEach((headerToGroup) => {\n // What is the latest (last) parent column?\n\n const latestPendingParentHeader =\n pendingParentHeaders[pendingParentHeaders.length - 1]\n\n const isLeafHeader = headerToGroup.column.depth === headerGroup.depth\n\n let column: Column<TFeatures, TData, TValue>\n let isPlaceholder = false\n\n if (isLeafHeader && headerToGroup.column.parent) {\n // The parent header is new\n column = headerToGroup.column.parent\n } else {\n // The parent header is repeated\n column = headerToGroup.column\n isPlaceholder = true\n }\n\n if (\n latestPendingParentHeader &&\n latestPendingParentHeader.column === column\n ) {\n // This column is repeated. Add it as a sub header to the next batch\n latestPendingParentHeader.subHeaders.push(headerToGroup)\n } else {\n // This is a new header. Let's create it\n const header = constructHeader(table, column, {\n id: [headerFamily, depth, column.id, headerToGroup.id]\n .filter(Boolean)\n .join('_'),\n isPlaceholder,\n placeholderId: isPlaceholder\n ? `${pendingParentHeaders.filter((d) => d.column === column).length}`\n : undefined,\n depth,\n index: pendingParentHeaders.length,\n })\n\n // Add the headerToGroup as a subHeader of the new header\n header.subHeaders.push(headerToGroup)\n // Add the new header to the pendingParentHeaders to get grouped\n // in the next batch\n pendingParentHeaders.push(header)\n }\n\n headerGroup.headers.push(\n headerToGroup as Header<TFeatures, TData, unknown>,\n )\n headerToGroup.headerGroup = headerGroup\n })\n\n headerGroups.push(headerGroup)\n\n if (depth > 0) {\n constructHeaderGroup(pendingParentHeaders, depth - 1)\n }\n }\n\n const bottomHeaders = columnsToGroup.map((column, index) =>\n constructHeader(table, column, {\n depth: maxDepth,\n index,\n }),\n )\n\n constructHeaderGroup(bottomHeaders, maxDepth - 1)\n\n headerGroups.reverse()\n\n const recurseHeadersForSpans = (\n headers: Array<Header<TFeatures, TData, TValue>>,\n ): Array<{ colSpan: number; rowSpan: number }> => {\n const results: Array<{ colSpan: number; rowSpan: number }> = []\n\n for (let i = 0; i < headers.length; i++) {\n const header = headers[i]!\n if (\n !callMemoOrStaticFn(header.column, 'getIsVisible', column_getIsVisible)\n ) {\n continue\n }\n\n let colSpan = 0\n let minChildRowSpan = Infinity\n\n if (header.subHeaders.length) {\n const childSpans = recurseHeadersForSpans(header.subHeaders)\n for (let j = 0; j < childSpans.length; j++) {\n const child = childSpans[j]!\n colSpan += child.colSpan\n if (child.rowSpan < minChildRowSpan) {\n minChildRowSpan = child.rowSpan\n }\n }\n } else {\n colSpan = 1\n minChildRowSpan = 0\n }\n\n header.colSpan = colSpan\n header.rowSpan = minChildRowSpan\n\n results.push({ colSpan, rowSpan: header.rowSpan })\n }\n\n return results\n }\n\n recurseHeadersForSpans(\n (headerGroups[0]?.headers ?? []) as Array<Header<TFeatures, TData, TValue>>,\n )\n\n return headerGroups\n}\n"],"mappings":";;;;;;;;;;AAeA,SAAgB,kBAKd,YACA,gBACA,OACA,cACA;;CAOA,IAAI,WAAW;CAEf,MAAM,gBACJ,SACA,QAAQ,MACL;EACH,WAAW,KAAK,IAAI,UAAU,KAAK;EAEnC,KAAK,IAAI,IAAI,GAAG,IAAI,QAAQ,QAAQ,KAAK;GACvC,MAAM,SAAS,QAAQ;GACvB,IAAI,mBAAmB,QAAQ,gBAAgB,mBAAmB,GAChE;QAAI,OAAO,QAAQ,QACjB,aAAa,OAAO,SAAS,QAAQ,CAAC;GACxC;EAEJ;CACF;CAEA,aAAa,UAAU;CAEvB,MAAM,eAAqD,CAAC;CAE5D,MAAM,wBACJ,gBACA,UACG;EAEH,MAAM,cAA6C;GACjD;GACA,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG;GACvD,SAAS,CAAC;EACZ;EAGA,MAAM,uBAAgE,CAAC;EAGvE,eAAe,SAAS,kBAAkB;GAGxC,MAAM,4BACJ,qBAAqB,qBAAqB,SAAS;GAErD,MAAM,eAAe,cAAc,OAAO,UAAU,YAAY;GAEhE,IAAI;GACJ,IAAI,gBAAgB;GAEpB,IAAI,gBAAgB,cAAc,OAAO,QAEvC,SAAS,cAAc,OAAO;QACzB;IAEL,SAAS,cAAc;IACvB,gBAAgB;GAClB;GAEA,IACE,6BACA,0BAA0B,WAAW,QAGrC,0BAA0B,WAAW,KAAK,aAAa;QAClD;IAEL,MAAM,SAAS,gBAAgB,OAAO,QAAQ;KAC5C,IAAI;MAAC;MAAc;MAAO,OAAO;MAAI,cAAc;KAAE,CAAC,CACnD,OAAO,OAAO,CAAC,CACf,KAAK,GAAG;KACX;KACA,eAAe,gBACX,GAAG,qBAAqB,QAAQ,MAAM,EAAE,WAAW,MAAM,CAAC,CAAC,WAC3D;KACJ;KACA,OAAO,qBAAqB;IAC9B,CAAC;IAGD,OAAO,WAAW,KAAK,aAAa;IAGpC,qBAAqB,KAAK,MAAM;GAClC;GAEA,YAAY,QAAQ,KAClB,aACF;GACA,cAAc,cAAc;EAC9B,CAAC;EAED,aAAa,KAAK,WAAW;EAE7B,IAAI,QAAQ,GACV,qBAAqB,sBAAsB,QAAQ,CAAC;CAExD;CASA,qBAPsB,eAAe,KAAK,QAAQ,UAChD,gBAAgB,OAAO,QAAQ;EAC7B,OAAO;EACP;CACF,CAAC,CAG8B,GAAG,WAAW,CAAC;CAEhD,aAAa,QAAQ;CAErB,MAAM,0BACJ,YACgD;EAChD,MAAM,UAAuD,CAAC;EAE9D,KAAK,IAAI,IAAI,GAAG,IAAI,QAAQ,QAAQ,KAAK;GACvC,MAAM,SAAS,QAAQ;GACvB,IACE,CAAC,mBAAmB,OAAO,QAAQ,gBAAgB,mBAAmB,GAEtE;GAGF,IAAI,UAAU;GACd,IAAI,kBAAkB;GAEtB,IAAI,OAAO,WAAW,QAAQ;IAC5B,MAAM,aAAa,uBAAuB,OAAO,UAAU;IAC3D,KAAK,IAAI,IAAI,GAAG,IAAI,WAAW,QAAQ,KAAK;KAC1C,MAAM,QAAQ,WAAW;KACzB,WAAW,MAAM;KACjB,IAAI,MAAM,UAAU,iBAClB,kBAAkB,MAAM;IAE5B;GACF,OAAO;IACL,UAAU;IACV,kBAAkB;GACpB;GAEA,OAAO,UAAU;GACjB,OAAO,UAAU;GAEjB,QAAQ,KAAK;IAAE;IAAS,SAAS,OAAO;GAAQ,CAAC;EACnD;EAEA,OAAO;CACT;CAEA,0CACG,aAAa,oEAAI,YAAW,CAAC,CAChC;CAEA,OAAO;AACT"}
|
|
@@ -6,7 +6,7 @@ import { Table } from "../../types/Table.cjs";
|
|
|
6
6
|
import { TableFeatures } from "../../types/TableFeatures.cjs";
|
|
7
7
|
|
|
8
8
|
//#region src/core/headers/coreHeadersFeature.types.d.ts
|
|
9
|
-
interface Table_Headers<TFeatures extends TableFeatures, TData extends RowData> {
|
|
9
|
+
interface Table_Headers<in out TFeatures extends TableFeatures, in out TData extends RowData> {
|
|
10
10
|
/**
|
|
11
11
|
* Builds the visible header groups for the current column tree, visibility,
|
|
12
12
|
* and pinning state.
|
|
@@ -26,7 +26,7 @@ interface Table_Headers<TFeatures extends TableFeatures, TData extends RowData>
|
|
|
26
26
|
*/
|
|
27
27
|
getLeafHeaders: () => Array<Header<TFeatures, TData, unknown>>;
|
|
28
28
|
}
|
|
29
|
-
interface HeaderContext<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData> {
|
|
29
|
+
interface HeaderContext<in out TFeatures extends TableFeatures, in out TData extends RowData, TValue extends CellData = CellData> {
|
|
30
30
|
/**
|
|
31
31
|
* An instance of a column.
|
|
32
32
|
*/
|
|
@@ -40,7 +40,7 @@ interface HeaderContext<TFeatures extends TableFeatures, TData extends RowData,
|
|
|
40
40
|
*/
|
|
41
41
|
table: Table<TFeatures, TData>;
|
|
42
42
|
}
|
|
43
|
-
interface Header_CoreProperties<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData> {
|
|
43
|
+
interface Header_CoreProperties<in out TFeatures extends TableFeatures, in out TData extends RowData, TValue extends CellData = CellData> {
|
|
44
44
|
/**
|
|
45
45
|
* The col-span for the header.
|
|
46
46
|
*/
|
|
@@ -86,7 +86,7 @@ interface Header_CoreProperties<TFeatures extends TableFeatures, TData extends R
|
|
|
86
86
|
*/
|
|
87
87
|
table: Table<TFeatures, TData>;
|
|
88
88
|
}
|
|
89
|
-
interface Header_Header<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData> extends Header_CoreProperties<TFeatures, TData, TValue> {
|
|
89
|
+
interface Header_Header<in out TFeatures extends TableFeatures, in out TData extends RowData, TValue extends CellData = CellData> extends Header_CoreProperties<TFeatures, TData, TValue> {
|
|
90
90
|
/**
|
|
91
91
|
* Returns the rendering context (or props) for column-based components like headers, footers and filters.
|
|
92
92
|
*/
|
|
@@ -96,7 +96,7 @@ interface Header_Header<TFeatures extends TableFeatures, TData extends RowData,
|
|
|
96
96
|
*/
|
|
97
97
|
getLeafHeaders: () => Array<Header<TFeatures, TData, TValue>>;
|
|
98
98
|
}
|
|
99
|
-
interface HeaderGroup_Header<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData> {
|
|
99
|
+
interface HeaderGroup_Header<in out TFeatures extends TableFeatures, in out TData extends RowData, TValue extends CellData = CellData> {
|
|
100
100
|
depth: number;
|
|
101
101
|
headers: Array<Header<TFeatures, TData, TValue>>;
|
|
102
102
|
id: string;
|
|
@@ -6,7 +6,7 @@ import { Table } from "../../types/Table.js";
|
|
|
6
6
|
import { TableFeatures } from "../../types/TableFeatures.js";
|
|
7
7
|
|
|
8
8
|
//#region src/core/headers/coreHeadersFeature.types.d.ts
|
|
9
|
-
interface Table_Headers<TFeatures extends TableFeatures, TData extends RowData> {
|
|
9
|
+
interface Table_Headers<in out TFeatures extends TableFeatures, in out TData extends RowData> {
|
|
10
10
|
/**
|
|
11
11
|
* Builds the visible header groups for the current column tree, visibility,
|
|
12
12
|
* and pinning state.
|
|
@@ -26,7 +26,7 @@ interface Table_Headers<TFeatures extends TableFeatures, TData extends RowData>
|
|
|
26
26
|
*/
|
|
27
27
|
getLeafHeaders: () => Array<Header<TFeatures, TData, unknown>>;
|
|
28
28
|
}
|
|
29
|
-
interface HeaderContext<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData> {
|
|
29
|
+
interface HeaderContext<in out TFeatures extends TableFeatures, in out TData extends RowData, TValue extends CellData = CellData> {
|
|
30
30
|
/**
|
|
31
31
|
* An instance of a column.
|
|
32
32
|
*/
|
|
@@ -40,7 +40,7 @@ interface HeaderContext<TFeatures extends TableFeatures, TData extends RowData,
|
|
|
40
40
|
*/
|
|
41
41
|
table: Table<TFeatures, TData>;
|
|
42
42
|
}
|
|
43
|
-
interface Header_CoreProperties<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData> {
|
|
43
|
+
interface Header_CoreProperties<in out TFeatures extends TableFeatures, in out TData extends RowData, TValue extends CellData = CellData> {
|
|
44
44
|
/**
|
|
45
45
|
* The col-span for the header.
|
|
46
46
|
*/
|
|
@@ -86,7 +86,7 @@ interface Header_CoreProperties<TFeatures extends TableFeatures, TData extends R
|
|
|
86
86
|
*/
|
|
87
87
|
table: Table<TFeatures, TData>;
|
|
88
88
|
}
|
|
89
|
-
interface Header_Header<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData> extends Header_CoreProperties<TFeatures, TData, TValue> {
|
|
89
|
+
interface Header_Header<in out TFeatures extends TableFeatures, in out TData extends RowData, TValue extends CellData = CellData> extends Header_CoreProperties<TFeatures, TData, TValue> {
|
|
90
90
|
/**
|
|
91
91
|
* Returns the rendering context (or props) for column-based components like headers, footers and filters.
|
|
92
92
|
*/
|
|
@@ -96,7 +96,7 @@ interface Header_Header<TFeatures extends TableFeatures, TData extends RowData,
|
|
|
96
96
|
*/
|
|
97
97
|
getLeafHeaders: () => Array<Header<TFeatures, TData, TValue>>;
|
|
98
98
|
}
|
|
99
|
-
interface HeaderGroup_Header<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData> {
|
|
99
|
+
interface HeaderGroup_Header<in out TFeatures extends TableFeatures, in out TData extends RowData, TValue extends CellData = CellData> {
|
|
100
100
|
depth: number;
|
|
101
101
|
headers: Array<Header<TFeatures, TData, TValue>>;
|
|
102
102
|
id: string;
|
|
@@ -9,15 +9,15 @@ import { Table_RowModels_Faceted } from "../../features/column-faceting/columnFa
|
|
|
9
9
|
import { Table_RowModels_Grouped } from "../../features/column-grouping/columnGroupingFeature.types.cjs";
|
|
10
10
|
|
|
11
11
|
//#region src/core/row-models/coreRowModelsFeature.types.d.ts
|
|
12
|
-
interface RowModel<TFeatures extends TableFeatures, TData extends RowData> {
|
|
12
|
+
interface RowModel<in out TFeatures extends TableFeatures, in out TData extends RowData> {
|
|
13
13
|
rows: Array<Row<TFeatures, TData>>;
|
|
14
14
|
flatRows: Array<Row<TFeatures, TData>>;
|
|
15
15
|
rowsById: Record<string, Row<TFeatures, TData>>;
|
|
16
16
|
}
|
|
17
|
-
interface CachedRowModel_Core<TFeatures extends TableFeatures, TData extends RowData> {
|
|
17
|
+
interface CachedRowModel_Core<in out TFeatures extends TableFeatures, in out TData extends RowData> {
|
|
18
18
|
coreRowModel: () => RowModel<TFeatures, TData>;
|
|
19
19
|
}
|
|
20
|
-
interface Table_RowModels_Core<TFeatures extends TableFeatures, TData extends RowData> {
|
|
20
|
+
interface Table_RowModels_Core<in out TFeatures extends TableFeatures, in out TData extends RowData> {
|
|
21
21
|
/**
|
|
22
22
|
* Returns the core row model before any processing has been applied.
|
|
23
23
|
*/
|
|
@@ -9,15 +9,15 @@ import { Table_RowModels_Faceted } from "../../features/column-faceting/columnFa
|
|
|
9
9
|
import { Table_RowModels_Grouped } from "../../features/column-grouping/columnGroupingFeature.types.js";
|
|
10
10
|
|
|
11
11
|
//#region src/core/row-models/coreRowModelsFeature.types.d.ts
|
|
12
|
-
interface RowModel<TFeatures extends TableFeatures, TData extends RowData> {
|
|
12
|
+
interface RowModel<in out TFeatures extends TableFeatures, in out TData extends RowData> {
|
|
13
13
|
rows: Array<Row<TFeatures, TData>>;
|
|
14
14
|
flatRows: Array<Row<TFeatures, TData>>;
|
|
15
15
|
rowsById: Record<string, Row<TFeatures, TData>>;
|
|
16
16
|
}
|
|
17
|
-
interface CachedRowModel_Core<TFeatures extends TableFeatures, TData extends RowData> {
|
|
17
|
+
interface CachedRowModel_Core<in out TFeatures extends TableFeatures, in out TData extends RowData> {
|
|
18
18
|
coreRowModel: () => RowModel<TFeatures, TData>;
|
|
19
19
|
}
|
|
20
|
-
interface Table_RowModels_Core<TFeatures extends TableFeatures, TData extends RowData> {
|
|
20
|
+
interface Table_RowModels_Core<in out TFeatures extends TableFeatures, in out TData extends RowData> {
|
|
21
21
|
/**
|
|
22
22
|
* Returns the core row model before any processing has been applied.
|
|
23
23
|
*/
|
|
@@ -9,8 +9,7 @@ const require_rowPaginationFeature_utils = require('../../features/row-paginatio
|
|
|
9
9
|
* The factory reads the relevant table state atoms and options, then returns a row model function used by the table row-model pipeline.
|
|
10
10
|
*/
|
|
11
11
|
function createCoreRowModel() {
|
|
12
|
-
return (
|
|
13
|
-
const table = _table;
|
|
12
|
+
return (table) => {
|
|
14
13
|
return require_utils.tableMemo({
|
|
15
14
|
feature: "coreRowModelsFeature",
|
|
16
15
|
table,
|
|
@@ -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 {
|
|
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: {},\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,UAAU,CAAC;CACb;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_Internal } 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_Internal<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_Internal } 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_Internal<TFeatures, TData>) => () => RowModel<TFeatures, TData>;
|
|
13
13
|
//#endregion
|
|
14
14
|
export { createCoreRowModel };
|
|
15
15
|
//# sourceMappingURL=createCoreRowModel.d.ts.map
|
|
@@ -9,8 +9,7 @@ import { table_autoResetPageIndex } from "../../features/row-pagination/rowPagin
|
|
|
9
9
|
* The factory reads the relevant table state atoms and options, then returns a row model function used by the table row-model pipeline.
|
|
10
10
|
*/
|
|
11
11
|
function createCoreRowModel() {
|
|
12
|
-
return (
|
|
13
|
-
const table = _table;
|
|
12
|
+
return (table) => {
|
|
14
13
|
return tableMemo({
|
|
15
14
|
feature: "coreRowModelsFeature",
|
|
16
15
|
table,
|
|
@@ -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 {
|
|
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: {},\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;CACb;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"}
|
|
@@ -5,7 +5,7 @@ import { TableFeatures } from "../../types/TableFeatures.cjs";
|
|
|
5
5
|
import { Cell } from "../../types/Cell.cjs";
|
|
6
6
|
|
|
7
7
|
//#region src/core/rows/coreRowsFeature.types.d.ts
|
|
8
|
-
interface Row_CoreProperties<TFeatures extends TableFeatures, TData extends RowData> {
|
|
8
|
+
interface Row_CoreProperties<in out TFeatures extends TableFeatures, in out TData extends RowData> {
|
|
9
9
|
_uniqueValuesCache: Record<string, unknown>;
|
|
10
10
|
_valuesCache: Record<string, unknown>;
|
|
11
11
|
/**
|
|
@@ -41,7 +41,7 @@ interface Row_CoreProperties<TFeatures extends TableFeatures, TData extends RowD
|
|
|
41
41
|
*/
|
|
42
42
|
table: Table_Internal<TFeatures, TData>;
|
|
43
43
|
}
|
|
44
|
-
interface Row_Row<TFeatures extends TableFeatures, TData extends RowData> extends Row_CoreProperties<TFeatures, TData> {
|
|
44
|
+
interface Row_Row<in out TFeatures extends TableFeatures, in out TData extends RowData> extends Row_CoreProperties<TFeatures, TData> {
|
|
45
45
|
/**
|
|
46
46
|
* Builds a lookup of this row's cells keyed by leaf column id.
|
|
47
47
|
*/
|
|
@@ -75,7 +75,7 @@ interface Row_Row<TFeatures extends TableFeatures, TData extends RowData> extend
|
|
|
75
75
|
*/
|
|
76
76
|
renderValue: <TValue>(columnId: string) => TValue;
|
|
77
77
|
}
|
|
78
|
-
interface TableOptions_Rows<TFeatures extends TableFeatures, TData extends RowData> {
|
|
78
|
+
interface TableOptions_Rows<in out TFeatures extends TableFeatures, in out TData extends RowData> {
|
|
79
79
|
/**
|
|
80
80
|
* This optional function is used to derive a unique ID for any given row. If not provided the rows index is used (nested rows join together with `.` using their grandparents' index eg. `index.index.index`). If you need to identify individual rows that are originating from any server-side operations, it's suggested you use this function to return an ID that makes sense regardless of network IO/ambiguity eg. a userId, taskId, database ID field, etc.
|
|
81
81
|
* @example getRowId: row => row.userId
|
|
@@ -87,7 +87,7 @@ interface TableOptions_Rows<TFeatures extends TableFeatures, TData extends RowDa
|
|
|
87
87
|
*/
|
|
88
88
|
getSubRows?: (originalRow: TData, index: number) => undefined | ReadonlyArray<TData>;
|
|
89
89
|
}
|
|
90
|
-
interface Table_Rows<TFeatures extends TableFeatures, TData extends RowData> {
|
|
90
|
+
interface Table_Rows<in out TFeatures extends TableFeatures, in out TData extends RowData> {
|
|
91
91
|
getRowId: (_: TData, index: number, parent?: Row<TFeatures, TData>) => string;
|
|
92
92
|
/**
|
|
93
93
|
* Returns the row with the given ID.
|