@tanstack/table-core 9.0.0-alpha.12 → 9.0.0-alpha.13
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/esm/core/columns/coreColumnsFeature.types.d.ts +1 -1
- package/dist/esm/core/columns/coreColumnsFeature.utils.js.map +1 -1
- package/dist/esm/core/row-models/createCoreRowModel.js.map +1 -1
- package/dist/esm/core/rows/coreRowsFeature.types.d.ts +2 -2
- package/dist/esm/core/table/coreTablesFeature.types.d.ts +1 -1
- package/dist/esm/types/ColumnDef.d.ts +1 -1
- package/package.json +1 -1
- package/src/core/columns/coreColumnsFeature.types.ts +1 -1
- package/src/core/columns/coreColumnsFeature.utils.ts +1 -1
- package/src/core/row-models/createCoreRowModel.ts +2 -2
- package/src/core/rows/coreRowsFeature.types.ts +5 -2
- package/src/core/table/coreTablesFeature.types.ts +1 -1
- package/src/types/ColumnDef.ts +1 -1
|
@@ -50,7 +50,7 @@ export interface TableOptions_Columns<TFeatures extends TableFeatures, TData ext
|
|
|
50
50
|
/**
|
|
51
51
|
* The array of column defs to use for the table.
|
|
52
52
|
*/
|
|
53
|
-
columns:
|
|
53
|
+
columns: ReadonlyArray<ColumnDef<TFeatures, TData, TValue>>;
|
|
54
54
|
/**
|
|
55
55
|
* Default column options to use for all column defs supplied to the table.
|
|
56
56
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coreColumnsFeature.utils.js","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\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\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\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\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:
|
|
1
|
+
{"version":3,"file":"coreColumnsFeature.utils.js","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\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\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\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\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 as any)\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\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 return table.getAllFlatColumns().reduce(\n (acc, column) => {\n acc[column.id] = column\n return acc\n },\n {} as Record<string, Column<TFeatures, TData, unknown>>,\n )\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 any) as any\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"],"names":[],"mappings":";;;AAaO,SAAS,sBAKd,QACyC;AACzC,SAAO,CAAC,QAAQ,GAAG,OAAO,QAAQ,QAAQ,CAAC,QAAQ,IAAI,eAAA,CAAgB,CAAC;AAC1E;AAEO,SAAS,sBAKd,QACyC;AACzC,MAAI,OAAO,QAAQ,QAAQ;AACzB,UAAM,cAAc,OAAO,QAAQ;AAAA,MACjC,CAAC,QAAQ,IAAI,eAAA;AAAA;AAAA,IAAe;AAG9B,WAAO;AAAA,MACL,OAAO;AAAA,MACP;AAAA,MACA;AAAA,IAAA,EACA,WAAkB;AAAA,EACtB;AAEA,SAAO,CAAC,MAAM;AAChB;AAEO,SAAS,0BAId,OAC+C;AAC/C,SAAO;AAAA,IACL,QAAQ,CAAC,UAAU;AACjB,YAAM,oBAAoB,MAAM,OAAO,OACpC;AAEH,UAAI,kBAAkB,aAAa;AACjC,eAAO,kBAAkB;AAAA,MAC3B;AAEA,UAAI,kBAAkB,YAAY;AAChC,eAAO,kBAAkB;AAAA,MAC3B;AAEA,aAAO;AAAA,IACT;AAAA,IACA,MAAM,CAAC,UAAU,MAAM,YAAA,GAAoB,gBAAgB;AAAA,IAC3D,GAAG,OAAO,OAAO,MAAM,SAAS,EAAE,OAAO,CAAC,KAAK,YAAY;AACzD,aAAO,OAAO,OAAO,KAAK,QAAQ,uBAAuB;AAAA,IAC3D,GAAG,CAAA,CAAE;AAAA,IACL,GAAG,MAAM,QAAQ;AAAA,EAAA;AAErB;AAEO,SAAS,oBAId,OAC0C;AAC1C,QAAM,iBAAiB,CACrB,SACA,QACA,QAAQ,MACqC;AAC7C,WAAO,QAAQ,IAAI,CAAC,cAAc;AAChC,YAAM,SAAS,gBAAgB,OAAO,WAAW,OAAO,MAAM;AAE9D,YAAM,oBAAoB;AAM1B,aAAO,UAAU,kBAAkB,UAC/B,eAAe,kBAAkB,SAAS,QAAQ,QAAQ,CAAC,IAC3D,CAAA;AAEJ,aAAO;AAAA,IACT,CAAC;AAAA,EACH;AAEA,SAAO,eAAe,MAAM,QAAQ,OAAc;AACpD;AAEO,SAAS,wBAId,OAC0C;AAC1C,SAAO,MAAM,gBAAgB,QAAQ,CAAC,WAAW,OAAO,gBAAgB;AAC1E;AAEO,SAAS,4BAId,OACmD;AACnD,SAAO,MAAM,oBAAoB;AAAA,IAC/B,CAAC,KAAK,WAAW;AACf,UAAI,OAAO,EAAE,IAAI;AACjB,aAAO;AAAA,IACT;AAAA,IACA,CAAA;AAAA,EAAC;AAEL;AAEO,SAAS,wBAId,OAC0C;AAC1C,QAAM,cAAc,MAAM,cAAA,EAAgB;AAAA,IACxC,CAAC,MAAM,EAAE,eAAA;AAAA;AAAA,EAAe;AAE1B,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,EAAA,EACA,WAAkB;AACtB;AAEO,SAAS,gBAId,OACA,UAC+C;AAC/C,QAAM,SAAS,MAAM,sBAAA,EAAwB,QAAQ;AAErD,MAAI,QAAQ,IAAI,aAAa,iBAAiB,CAAC,QAAQ;AACrD,YAAQ,KAAK,2BAA2B,QAAQ,mBAAmB;AAAA,EACrE;AAEA,SAAO;AACT;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createCoreRowModel.js","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, 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\nexport function createCoreRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(): (table: Table<TFeatures, TData>) => () => RowModel<TFeatures, TData> {\n return (_table) => {\n const table = _table as Table_Internal<TFeatures, TData>\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:
|
|
1
|
+
{"version":3,"file":"createCoreRowModel.js","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, 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\nexport function createCoreRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(): (table: Table<TFeatures, TData>) => () => RowModel<TFeatures, TData> {\n return (_table) => {\n const table = _table as Table_Internal<TFeatures, TData>\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"],"names":[],"mappings":";;;AASO,SAAS,qBAG0D;AACxE,SAAO,CAAC,WAAW;AACjB,UAAM,QAAQ;AACd,WAAO,UAAU;AAAA,MACf,SAAS;AAAA,MACT;AAAA,MACA,QAAQ;AAAA,MACR,UAAU,MAAM,CAAC,MAAM,QAAQ,IAAI;AAAA,MACnC,IAAI,MAAM,oBAAoB,OAAO,MAAM,QAAQ,IAAI;AAAA,MACvD,eAAe,MAAM,yBAAyB,KAAK;AAAA,IAAA,CACpD;AAAA,EACH;AACF;AAEA,SAAS,oBAIP,OACA,MAKA;AACA,QAAM,WAAuC;AAAA,IAC3C,MAAM,CAAA;AAAA,IACN,UAAU,CAAA;AAAA,IACV,UAAU,CAAA;AAAA,EAAC;AAGb,QAAM,aAAa,CACjB,cACA,QAAQ,GACR,cACiC;AACjC,UAAM,OAAO,CAAA;AAEb,aAAS,IAAI,GAAG,IAAI,aAAa,QAAQ,KAAK;AAC5C,YAAM,cAAc,aAAa,CAAC;AAElC,YAAM,MAAM;AAAA,QACV;AAAA,QACA,MAAM,SAAS,aAAa,GAAG,SAAS;AAAA,QACxC;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA,WAAW;AAAA,MAAA;AAIb,eAAS,SAAS,KAAK,GAAG;AAE1B,eAAS,SAAS,IAAI,EAAE,IAAI;AAE5B,WAAK,KAAK,GAAG;AAGb,UAAI,MAAM,QAAQ,YAAY;AAC5B,YAAI,kBAAkB,MAAM,QAAQ,WAAW,aAAa,CAAC;AAG7D,YAAI,IAAI,iBAAiB,QAAQ;AAC/B,cAAI,UAAU,WAAW,IAAI,iBAAiB,QAAQ,GAAG,GAAG;AAAA,QAC9D;AAAA,MACF;AAAA,IACF;AAEA,WAAO;AAAA,EACT;AAEA,WAAS,OAAO,WAAW,IAAI;AAE/B,SAAO;AACT;"}
|
|
@@ -25,7 +25,7 @@ export interface Row_CoreProperties<TFeatures extends TableFeatures, TData exten
|
|
|
25
25
|
/**
|
|
26
26
|
* An array of the original subRows as returned by the `options.getSubRows` option.
|
|
27
27
|
*/
|
|
28
|
-
originalSubRows?:
|
|
28
|
+
originalSubRows?: ReadonlyArray<TData>;
|
|
29
29
|
/**
|
|
30
30
|
* If nested, this row's parent row id.
|
|
31
31
|
*/
|
|
@@ -80,7 +80,7 @@ export interface TableOptions_Rows<TFeatures extends TableFeatures, TData extend
|
|
|
80
80
|
* This optional function is used to access the sub rows for any given row. If you are using nested rows, you will need to use this function to return the sub rows object (or undefined) from the row.
|
|
81
81
|
* @example getSubRows: row => row.subRows
|
|
82
82
|
*/
|
|
83
|
-
getSubRows?: (originalRow: TData, index: number) => undefined |
|
|
83
|
+
getSubRows?: (originalRow: TData, index: number) => undefined | ReadonlyArray<TData>;
|
|
84
84
|
}
|
|
85
85
|
export interface Table_Rows<TFeatures extends TableFeatures, TData extends RowData> {
|
|
86
86
|
getRowId: (_: TData, index: number, parent?: Row<TFeatures, TData>) => string;
|
|
@@ -24,7 +24,7 @@ export interface TableOptions_Table<TFeatures extends TableFeatures, TData exten
|
|
|
24
24
|
/**
|
|
25
25
|
* The data for the table to display. When the `data` option changes reference, the table will reprocess the data.
|
|
26
26
|
*/
|
|
27
|
-
data:
|
|
27
|
+
data: ReadonlyArray<TData>;
|
|
28
28
|
/**
|
|
29
29
|
* Use this option to optionally pass initial state to the table. This state will be used when resetting various table states either automatically by the table (eg. `options.autoResetPageIndex`) or via functions like `table.resetRowSelection()`. Most reset function allow you optionally pass a flag to reset to a blank/default state instead of the initial state.
|
|
30
30
|
* Table state will not be reset when this object changes, which also means that the initial state object does not need to be stable.
|
|
@@ -44,7 +44,7 @@ export type IdentifiedColumnDef<TFeatures extends TableFeatures, TData extends R
|
|
|
44
44
|
};
|
|
45
45
|
export type DisplayColumnDef<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData> = ColumnDefBase<TFeatures, TData, TValue> & ColumnIdentifiers<TFeatures, TData, TValue>;
|
|
46
46
|
type GroupColumnDefBase<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData> = ColumnDefBase<TFeatures, TData, TValue> & {
|
|
47
|
-
columns?:
|
|
47
|
+
columns?: ReadonlyArray<ColumnDef<TFeatures, TData, unknown>>;
|
|
48
48
|
};
|
|
49
49
|
export type GroupColumnDef<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData> = GroupColumnDefBase<TFeatures, TData, TValue> & ColumnIdentifiers<TFeatures, TData, TValue>;
|
|
50
50
|
export type AccessorFnColumnDefBase<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData> = ColumnDefBase<TFeatures, TData, TValue> & {
|
package/package.json
CHANGED
|
@@ -65,7 +65,7 @@ export interface TableOptions_Columns<
|
|
|
65
65
|
/**
|
|
66
66
|
* The array of column defs to use for the table.
|
|
67
67
|
*/
|
|
68
|
-
columns:
|
|
68
|
+
columns: ReadonlyArray<ColumnDef<TFeatures, TData, TValue>>
|
|
69
69
|
/**
|
|
70
70
|
* Default column options to use for all column defs supplied to the table.
|
|
71
71
|
*/
|
|
@@ -79,7 +79,7 @@ export function table_getAllColumns<
|
|
|
79
79
|
table: Table_Internal<TFeatures, TData>,
|
|
80
80
|
): Array<Column<TFeatures, TData, unknown>> {
|
|
81
81
|
const recurseColumns = (
|
|
82
|
-
colDefs:
|
|
82
|
+
colDefs: ReadonlyArray<ColumnDef<TFeatures, TData, unknown>>,
|
|
83
83
|
parent?: Column<TFeatures, TData, unknown>,
|
|
84
84
|
depth = 0,
|
|
85
85
|
): Array<Column<TFeatures, TData, unknown>> => {
|
|
@@ -29,7 +29,7 @@ function _createCoreRowModel<
|
|
|
29
29
|
TData extends RowData,
|
|
30
30
|
>(
|
|
31
31
|
table: Table_Internal<TFeatures, TData>,
|
|
32
|
-
data:
|
|
32
|
+
data: ReadonlyArray<TData>,
|
|
33
33
|
): {
|
|
34
34
|
rows: Array<Row<TFeatures, TData>>
|
|
35
35
|
flatRows: Array<Row<TFeatures, TData>>
|
|
@@ -42,7 +42,7 @@ function _createCoreRowModel<
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
const accessRows = (
|
|
45
|
-
originalRows:
|
|
45
|
+
originalRows: ReadonlyArray<TData>,
|
|
46
46
|
depth = 0,
|
|
47
47
|
parentRow?: Row<TFeatures, TData>,
|
|
48
48
|
): Array<Row<TFeatures, TData>> => {
|
|
@@ -29,7 +29,7 @@ export interface Row_CoreProperties<
|
|
|
29
29
|
/**
|
|
30
30
|
* An array of the original subRows as returned by the `options.getSubRows` option.
|
|
31
31
|
*/
|
|
32
|
-
originalSubRows?:
|
|
32
|
+
originalSubRows?: ReadonlyArray<TData>
|
|
33
33
|
/**
|
|
34
34
|
* If nested, this row's parent row id.
|
|
35
35
|
*/
|
|
@@ -96,7 +96,10 @@ export interface TableOptions_Rows<
|
|
|
96
96
|
* This optional function is used to access the sub rows for any given row. If you are using nested rows, you will need to use this function to return the sub rows object (or undefined) from the row.
|
|
97
97
|
* @example getSubRows: row => row.subRows
|
|
98
98
|
*/
|
|
99
|
-
getSubRows?: (
|
|
99
|
+
getSubRows?: (
|
|
100
|
+
originalRow: TData,
|
|
101
|
+
index: number,
|
|
102
|
+
) => undefined | ReadonlyArray<TData>
|
|
100
103
|
}
|
|
101
104
|
|
|
102
105
|
export interface Table_Rows<
|
|
@@ -31,7 +31,7 @@ export interface TableOptions_Table<
|
|
|
31
31
|
/**
|
|
32
32
|
* The data for the table to display. When the `data` option changes reference, the table will reprocess the data.
|
|
33
33
|
*/
|
|
34
|
-
data:
|
|
34
|
+
data: ReadonlyArray<TData>
|
|
35
35
|
/**
|
|
36
36
|
* Use this option to optionally pass initial state to the table. This state will be used when resetting various table states either automatically by the table (eg. `options.autoResetPageIndex`) or via functions like `table.resetRowSelection()`. Most reset function allow you optionally pass a flag to reset to a blank/default state instead of the initial state.
|
|
37
37
|
* Table state will not be reset when this object changes, which also means that the initial state object does not need to be stable.
|
package/src/types/ColumnDef.ts
CHANGED
|
@@ -150,7 +150,7 @@ type GroupColumnDefBase<
|
|
|
150
150
|
TData extends RowData,
|
|
151
151
|
TValue extends CellData = CellData,
|
|
152
152
|
> = ColumnDefBase<TFeatures, TData, TValue> & {
|
|
153
|
-
columns?:
|
|
153
|
+
columns?: ReadonlyArray<ColumnDef<TFeatures, TData, unknown>>
|
|
154
154
|
}
|
|
155
155
|
|
|
156
156
|
export type GroupColumnDef<
|