@tanstack/table-core 8.17.3 → 8.19.2

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.
@@ -1 +1 @@
1
- {"version":3,"file":"cell.js","sources":["../../../src/core/cell.ts"],"sourcesContent":["import { RowData, Cell, Column, Row, Table } from '../types'\nimport { Getter, getMemoOptions, memo } from '../utils'\n\nexport interface CellContext<TData extends RowData, TValue> {\n cell: Cell<TData, TValue>\n column: Column<TData, TValue>\n getValue: Getter<TValue>\n renderValue: Getter<TValue | null>\n row: Row<TData>\n table: Table<TData>\n}\n\nexport interface CoreCell<TData extends RowData, TValue> {\n /**\n * The associated Column object for the cell.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/cell#column)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/cells)\n */\n column: Column<TData, TValue>\n /**\n * 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:\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/cell#getcontext)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/cells)\n */\n getContext: () => CellContext<TData, TValue>\n /**\n * Returns the value for the cell, accessed via the associated column's accessor key or accessor function.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/cell#getvalue)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/cells)\n */\n getValue: CellContext<TData, TValue>['getValue']\n /**\n * The unique ID for the cell across the entire table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/cell#id)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/cells)\n */\n id: string\n /**\n * Renders the value for a cell the same as `getValue`, but will return the `renderFallbackValue` if no value is found.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/cell#rendervalue)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/cells)\n */\n renderValue: CellContext<TData, TValue>['renderValue']\n /**\n * The associated Row object for the cell.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/cell#row)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/cells)\n */\n row: Row<TData>\n}\n\nexport function createCell<TData extends RowData, TValue>(\n table: Table<TData>,\n row: Row<TData>,\n column: Column<TData, TValue>,\n columnId: string\n): Cell<TData, TValue> {\n const getRenderValue = () =>\n cell.getValue() ?? table.options.renderFallbackValue\n\n const cell: CoreCell<TData, TValue> = {\n id: `${row.id}_${column.id}`,\n row,\n column,\n getValue: () => row.getValue(columnId),\n renderValue: getRenderValue,\n getContext: memo(\n () => [table, column, row, cell],\n (table, column, row, cell) => ({\n table,\n column,\n row,\n cell: cell as Cell<TData, TValue>,\n getValue: cell.getValue,\n renderValue: cell.renderValue,\n }),\n getMemoOptions(table.options, 'debugCells', 'cell.getContext')\n ),\n }\n\n table._features.forEach(feature => {\n feature.createCell?.(\n cell as Cell<TData, TValue>,\n column,\n row as Row<TData>,\n table\n )\n }, {})\n\n return cell as Cell<TData, TValue>\n}\n"],"names":["createCell","table","row","column","columnId","getRenderValue","_cell$getValue","cell","getValue","options","renderFallbackValue","id","renderValue","getContext","memo","getMemoOptions","_features","forEach","feature"],"mappings":";;;;;;;;;;;;;;AAmDO,SAASA,UAAUA,CACxBC,KAAmB,EACnBC,GAAe,EACfC,MAA6B,EAC7BC,QAAgB,EACK;EACrB,MAAMC,cAAc,GAAGA,MAAA;AAAA,IAAA,IAAAC,cAAA,CAAA;AAAA,IAAA,OAAA,CAAAA,cAAA,GACrBC,IAAI,CAACC,QAAQ,EAAE,KAAAF,IAAAA,GAAAA,cAAA,GAAIL,KAAK,CAACQ,OAAO,CAACC,mBAAmB,CAAA;AAAA,GAAA,CAAA;AAEtD,EAAA,MAAMH,IAA6B,GAAG;IACpCI,EAAE,EAAG,GAAET,GAAG,CAACS,EAAG,CAAGR,CAAAA,EAAAA,MAAM,CAACQ,EAAG,CAAC,CAAA;IAC5BT,GAAG;IACHC,MAAM;IACNK,QAAQ,EAAEA,MAAMN,GAAG,CAACM,QAAQ,CAACJ,QAAQ,CAAC;AACtCQ,IAAAA,WAAW,EAAEP,cAAc;IAC3BQ,UAAU,EAAEC,UAAI,CACd,MAAM,CAACb,KAAK,EAAEE,MAAM,EAAED,GAAG,EAAEK,IAAI,CAAC,EAChC,CAACN,KAAK,EAAEE,MAAM,EAAED,GAAG,EAAEK,IAAI,MAAM;MAC7BN,KAAK;MACLE,MAAM;MACND,GAAG;AACHK,MAAAA,IAAI,EAAEA,IAA2B;MACjCC,QAAQ,EAAED,IAAI,CAACC,QAAQ;MACvBI,WAAW,EAAEL,IAAI,CAACK,WAAAA;KACnB,CAAC,EACFG,oBAAc,CAACd,KAAK,CAACQ,OAAO,EAAE,YAAY,EAAE,iBAAiB,CAC/D,CAAA;GACD,CAAA;AAEDR,EAAAA,KAAK,CAACe,SAAS,CAACC,OAAO,CAACC,OAAO,IAAI;AACjCA,IAAAA,OAAO,CAAClB,UAAU,IAAlBkB,IAAAA,IAAAA,OAAO,CAAClB,UAAU,CAChBO,IAAI,EACJJ,MAAM,EACND,GAAG,EACHD,KACF,CAAC,CAAA;GACF,EAAE,EAAE,CAAC,CAAA;AAEN,EAAA,OAAOM,IAAI,CAAA;AACb;;;;"}
1
+ {"version":3,"file":"cell.js","sources":["../../../src/core/cell.ts"],"sourcesContent":["import { RowData, Cell, Column, Row, Table } from '../types'\nimport { Getter, getMemoOptions, memo } from '../utils'\n\nexport interface CellContext<TData extends RowData, TValue> {\n cell: Cell<TData, TValue>\n column: Column<TData, TValue>\n getValue: Getter<TValue>\n renderValue: Getter<TValue | null>\n row: Row<TData>\n table: Table<TData>\n}\n\nexport interface CoreCell<TData extends RowData, TValue> {\n /**\n * The associated Column object for the cell.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/cell#column)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/cells)\n */\n column: Column<TData, TValue>\n /**\n * 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:\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/cell#getcontext)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/cells)\n */\n getContext: () => CellContext<TData, TValue>\n /**\n * Returns the value for the cell, accessed via the associated column's accessor key or accessor function.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/cell#getvalue)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/cells)\n */\n getValue: CellContext<TData, TValue>['getValue']\n /**\n * The unique ID for the cell across the entire table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/cell#id)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/cells)\n */\n id: string\n /**\n * Renders the value for a cell the same as `getValue`, but will return the `renderFallbackValue` if no value is found.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/cell#rendervalue)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/cells)\n */\n renderValue: CellContext<TData, TValue>['renderValue']\n /**\n * The associated Row object for the cell.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/cell#row)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/cells)\n */\n row: Row<TData>\n}\n\nexport function createCell<TData extends RowData, TValue>(\n table: Table<TData>,\n row: Row<TData>,\n column: Column<TData, TValue>,\n columnId: string\n): Cell<TData, TValue> {\n const getRenderValue = () =>\n cell.getValue() ?? table.options.renderFallbackValue\n\n const cell: CoreCell<TData, TValue> = {\n id: `${row.id}_${column.id}`,\n row,\n column,\n getValue: () => row.getValue(columnId),\n renderValue: getRenderValue,\n getContext: memo(\n () => [table, column, row, cell],\n (table, column, row, cell) => ({\n table,\n column,\n row,\n cell: cell as Cell<TData, TValue>,\n getValue: cell.getValue,\n renderValue: cell.renderValue,\n }),\n getMemoOptions(table.options, 'debugCells', 'cell.getContext')\n ),\n }\n\n table._features.forEach(feature => {\n feature.createCell?.(\n cell as Cell<TData, TValue>,\n column,\n row as Row<TData>,\n table\n )\n }, {})\n\n return cell as Cell<TData, TValue>\n}\n"],"names":["createCell","table","row","column","columnId","getRenderValue","_cell$getValue","cell","getValue","options","renderFallbackValue","id","renderValue","getContext","memo","getMemoOptions","_features","forEach","feature"],"mappings":";;;;;;;;;;;;;;AAmDO,SAASA,UAAUA,CACxBC,KAAmB,EACnBC,GAAe,EACfC,MAA6B,EAC7BC,QAAgB,EACK;EACrB,MAAMC,cAAc,GAAGA,MAAA;AAAA,IAAA,IAAAC,cAAA,CAAA;AAAA,IAAA,OAAA,CAAAA,cAAA,GACrBC,IAAI,CAACC,QAAQ,EAAE,KAAAF,IAAAA,GAAAA,cAAA,GAAIL,KAAK,CAACQ,OAAO,CAACC,mBAAmB,CAAA;AAAA,GAAA,CAAA;AAEtD,EAAA,MAAMH,IAA6B,GAAG;IACpCI,EAAE,EAAE,GAAGT,GAAG,CAACS,EAAE,CAAIR,CAAAA,EAAAA,MAAM,CAACQ,EAAE,CAAE,CAAA;IAC5BT,GAAG;IACHC,MAAM;IACNK,QAAQ,EAAEA,MAAMN,GAAG,CAACM,QAAQ,CAACJ,QAAQ,CAAC;AACtCQ,IAAAA,WAAW,EAAEP,cAAc;IAC3BQ,UAAU,EAAEC,UAAI,CACd,MAAM,CAACb,KAAK,EAAEE,MAAM,EAAED,GAAG,EAAEK,IAAI,CAAC,EAChC,CAACN,KAAK,EAAEE,MAAM,EAAED,GAAG,EAAEK,IAAI,MAAM;MAC7BN,KAAK;MACLE,MAAM;MACND,GAAG;AACHK,MAAAA,IAAI,EAAEA,IAA2B;MACjCC,QAAQ,EAAED,IAAI,CAACC,QAAQ;MACvBI,WAAW,EAAEL,IAAI,CAACK,WAAAA;KACnB,CAAC,EACFG,oBAAc,CAACd,KAAK,CAACQ,OAAO,EAAE,YAAY,EAAE,iBAAiB,CAC/D,CAAA;GACD,CAAA;AAEDR,EAAAA,KAAK,CAACe,SAAS,CAACC,OAAO,CAACC,OAAO,IAAI;AACjCA,IAAAA,OAAO,CAAClB,UAAU,IAAlBkB,IAAAA,IAAAA,OAAO,CAAClB,UAAU,CAChBO,IAAI,EACJJ,MAAM,EACND,GAAG,EACHD,KACF,CAAC,CAAA;GACF,EAAE,EAAE,CAAC,CAAA;AAEN,EAAA,OAAOM,IAAI,CAAA;AACb;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"column.js","sources":["../../../src/core/column.ts"],"sourcesContent":["import {\n Column,\n Table,\n AccessorFn,\n ColumnDef,\n RowData,\n ColumnDefResolved,\n} from '../types'\nimport { getMemoOptions, memo } from '../utils'\n\nexport interface CoreColumn<TData extends RowData, TValue> {\n /**\n * 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.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/column#accessorfn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-defs)\n */\n accessorFn?: AccessorFn<TData, TValue>\n /**\n * The original column def used to create the column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/column#columndef)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-defs)\n */\n columnDef: ColumnDef<TData, TValue>\n /**\n * The child column (if the column is a group column). Will be an empty array if the column is not a group column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/column#columns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-defs)\n */\n columns: Column<TData, TValue>[]\n /**\n * The depth of the column (if grouped) relative to the root column def array.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/column#depth)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-defs)\n */\n depth: number\n /**\n * Returns the flattened array of this column and all child/grand-child columns for this column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/column#getflatcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-defs)\n */\n getFlatColumns: () => Column<TData, TValue>[]\n /**\n * Returns an array of all leaf-node columns for this column. If a column has no children, it is considered the only leaf-node column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/column#getleafcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-defs)\n */\n getLeafColumns: () => Column<TData, TValue>[]\n /**\n * The resolved unique identifier for the column resolved in this priority:\n - A manual `id` property from the column def\n - The accessor key from the column def\n - The header string from the column def\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/column#id)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-defs)\n */\n id: string\n /**\n * The parent column for this column. Will be undefined if this is a root column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/column#parent)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-defs)\n */\n parent?: Column<TData, TValue>\n}\n\nexport function createColumn<TData extends RowData, TValue>(\n table: Table<TData>,\n columnDef: ColumnDef<TData, TValue>,\n depth: number,\n parent?: Column<TData, TValue>\n): Column<TData, TValue> {\n const defaultColumn = table._getDefaultColumnDef()\n\n const resolvedColumnDef = {\n ...defaultColumn,\n ...columnDef,\n } as ColumnDefResolved<TData>\n\n const accessorKey = resolvedColumnDef.accessorKey\n\n let id =\n resolvedColumnDef.id ??\n (accessorKey ? accessorKey.replace('.', '_') : undefined) ??\n (typeof resolvedColumnDef.header === 'string'\n ? resolvedColumnDef.header\n : undefined)\n\n let accessorFn: AccessorFn<TData> | undefined\n\n if (resolvedColumnDef.accessorFn) {\n accessorFn = resolvedColumnDef.accessorFn\n } else if (accessorKey) {\n // Support deep accessor keys\n if (accessorKey.includes('.')) {\n accessorFn = (originalRow: TData) => {\n let result = originalRow as Record<string, any>\n\n for (const key of accessorKey.split('.')) {\n result = result?.[key]\n if (process.env.NODE_ENV !== 'production' && result === undefined) {\n console.warn(\n `\"${key}\" in deeply nested key \"${accessorKey}\" returned undefined.`\n )\n }\n }\n\n return result\n }\n } else {\n accessorFn = (originalRow: TData) =>\n (originalRow as any)[resolvedColumnDef.accessorKey]\n }\n }\n\n if (!id) {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(\n resolvedColumnDef.accessorFn\n ? `Columns require an id when using an accessorFn`\n : `Columns require an id when using a non-string header`\n )\n }\n throw new Error()\n }\n\n let column: CoreColumn<TData, any> = {\n id: `${String(id)}`,\n accessorFn,\n parent: parent as any,\n depth,\n columnDef: resolvedColumnDef as ColumnDef<TData, any>,\n columns: [],\n getFlatColumns: memo(\n () => [true],\n () => {\n return [\n column as Column<TData, TValue>,\n ...column.columns?.flatMap(d => d.getFlatColumns()),\n ]\n },\n getMemoOptions(table.options, 'debugColumns', 'column.getFlatColumns')\n ),\n getLeafColumns: memo(\n () => [table._getOrderColumnsFn()],\n orderColumns => {\n if (column.columns?.length) {\n let leafColumns = column.columns.flatMap(column =>\n column.getLeafColumns()\n )\n\n return orderColumns(leafColumns)\n }\n\n return [column as Column<TData, TValue>]\n },\n getMemoOptions(table.options, 'debugColumns', 'column.getLeafColumns')\n ),\n }\n\n for (const feature of table._features) {\n feature.createColumn?.(column as Column<TData, TValue>, table)\n }\n\n // Yes, we have to convert table to unknown, because we know more than the compiler here.\n return column as Column<TData, TValue>\n}\n"],"names":["createColumn","table","columnDef","depth","parent","_ref","_resolvedColumnDef$id","defaultColumn","_getDefaultColumnDef","resolvedColumnDef","accessorKey","id","replace","undefined","header","accessorFn","includes","originalRow","result","key","split","_result","process","env","NODE_ENV","console","warn","Error","column","String","columns","getFlatColumns","memo","_column$columns","flatMap","d","getMemoOptions","options","getLeafColumns","_getOrderColumnsFn","orderColumns","_column$columns2","length","leafColumns","feature","_features"],"mappings":";;;;;;;;;;;;;;AAgEO,SAASA,YAAYA,CAC1BC,KAAmB,EACnBC,SAAmC,EACnCC,KAAa,EACbC,MAA8B,EACP;EAAA,IAAAC,IAAA,EAAAC,qBAAA,CAAA;AACvB,EAAA,MAAMC,aAAa,GAAGN,KAAK,CAACO,oBAAoB,EAAE,CAAA;AAElD,EAAA,MAAMC,iBAAiB,GAAG;AACxB,IAAA,GAAGF,aAAa;IAChB,GAAGL,SAAAA;GACwB,CAAA;AAE7B,EAAA,MAAMQ,WAAW,GAAGD,iBAAiB,CAACC,WAAW,CAAA;AAEjD,EAAA,IAAIC,EAAE,GAAA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MAEA,OAAO,CAACf,MAAM,CAA0B,CAAA;KACzC,EACDQ,oBAAc,CAACnC,KAAK,CAACoC,OAAO,EAAE,cAAc,EAAE,uBAAuB,CACvE,CAAA;GACD,CAAA;AAED,EAAA,KAAK,MAAMO,OAAO,IAAI3C,KAAK,CAAC4C,SAAS,EAAE;IACrCD,OAAO,CAAC5C,YAAY,IAAA,IAAA,IAApB4C,OAAO,CAAC5C,YAAY,CAAG4B,MAAM,EAA2B3B,KAAK,CAAC,CAAA;AAChE,GAAA;;AAEA;AACA,EAAA,OAAO2B,MAAM,CAAA;AACf;;;;"}
1
+ {"version":3,"file":"column.js","sources":["../../../src/core/column.ts"],"sourcesContent":["import {\n Column,\n Table,\n AccessorFn,\n ColumnDef,\n RowData,\n ColumnDefResolved,\n} from '../types'\nimport { getMemoOptions, memo } from '../utils'\n\nexport interface CoreColumn<TData extends RowData, TValue> {\n /**\n * 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.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/column#accessorfn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-defs)\n */\n accessorFn?: AccessorFn<TData, TValue>\n /**\n * The original column def used to create the column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/column#columndef)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-defs)\n */\n columnDef: ColumnDef<TData, TValue>\n /**\n * The child column (if the column is a group column). Will be an empty array if the column is not a group column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/column#columns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-defs)\n */\n columns: Column<TData, TValue>[]\n /**\n * The depth of the column (if grouped) relative to the root column def array.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/column#depth)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-defs)\n */\n depth: number\n /**\n * Returns the flattened array of this column and all child/grand-child columns for this column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/column#getflatcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-defs)\n */\n getFlatColumns: () => Column<TData, TValue>[]\n /**\n * Returns an array of all leaf-node columns for this column. If a column has no children, it is considered the only leaf-node column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/column#getleafcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-defs)\n */\n getLeafColumns: () => Column<TData, TValue>[]\n /**\n * The resolved unique identifier for the column resolved in this priority:\n - A manual `id` property from the column def\n - The accessor key from the column def\n - The header string from the column def\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/column#id)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-defs)\n */\n id: string\n /**\n * The parent column for this column. Will be undefined if this is a root column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/column#parent)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-defs)\n */\n parent?: Column<TData, TValue>\n}\n\nexport function createColumn<TData extends RowData, TValue>(\n table: Table<TData>,\n columnDef: ColumnDef<TData, TValue>,\n depth: number,\n parent?: Column<TData, TValue>\n): Column<TData, TValue> {\n const defaultColumn = table._getDefaultColumnDef()\n\n const resolvedColumnDef = {\n ...defaultColumn,\n ...columnDef,\n } as ColumnDefResolved<TData>\n\n const accessorKey = resolvedColumnDef.accessorKey\n\n let id =\n resolvedColumnDef.id ??\n (accessorKey ? accessorKey.replace('.', '_') : undefined) ??\n (typeof resolvedColumnDef.header === 'string'\n ? resolvedColumnDef.header\n : undefined)\n\n let accessorFn: AccessorFn<TData> | undefined\n\n if (resolvedColumnDef.accessorFn) {\n accessorFn = resolvedColumnDef.accessorFn\n } else if (accessorKey) {\n // Support deep accessor keys\n if (accessorKey.includes('.')) {\n accessorFn = (originalRow: TData) => {\n let result = originalRow as Record<string, any>\n\n for (const key of accessorKey.split('.')) {\n result = result?.[key]\n if (process.env.NODE_ENV !== 'production' && result === undefined) {\n console.warn(\n `\"${key}\" in deeply nested key \"${accessorKey}\" returned undefined.`\n )\n }\n }\n\n return result\n }\n } else {\n accessorFn = (originalRow: TData) =>\n (originalRow as any)[resolvedColumnDef.accessorKey]\n }\n }\n\n if (!id) {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(\n resolvedColumnDef.accessorFn\n ? `Columns require an id when using an accessorFn`\n : `Columns require an id when using a non-string header`\n )\n }\n throw new Error()\n }\n\n let column: CoreColumn<TData, any> = {\n id: `${String(id)}`,\n accessorFn,\n parent: parent as any,\n depth,\n columnDef: resolvedColumnDef as ColumnDef<TData, any>,\n columns: [],\n getFlatColumns: memo(\n () => [true],\n () => {\n return [\n column as Column<TData, TValue>,\n ...column.columns?.flatMap(d => d.getFlatColumns()),\n ]\n },\n getMemoOptions(table.options, 'debugColumns', 'column.getFlatColumns')\n ),\n getLeafColumns: memo(\n () => [table._getOrderColumnsFn()],\n orderColumns => {\n if (column.columns?.length) {\n let leafColumns = column.columns.flatMap(column =>\n column.getLeafColumns()\n )\n\n return orderColumns(leafColumns)\n }\n\n return [column as Column<TData, TValue>]\n },\n getMemoOptions(table.options, 'debugColumns', 'column.getLeafColumns')\n ),\n }\n\n for (const feature of table._features) {\n feature.createColumn?.(column as Column<TData, TValue>, table)\n }\n\n // Yes, we have to convert table to unknown, because we know more than the compiler here.\n return column as Column<TData, TValue>\n}\n"],"names":["createColumn","table","columnDef","depth","parent","_ref","_resolvedColumnDef$id","defaultColumn","_getDefaultColumnDef","resolvedColumnDef","accessorKey","id","replace","undefined","header","accessorFn","includes","originalRow","result","key","split","_result","process","env","NODE_ENV","console","warn","Error","column","String","columns","getFlatColumns","memo","_column$columns","flatMap","d","getMemoOptions","options","getLeafColumns","_getOrderColumnsFn","orderColumns","_column$columns2","length","leafColumns","feature","_features"],"mappings":";;;;;;;;;;;;;;AAgEO,SAASA,YAAYA,CAC1BC,KAAmB,EACnBC,SAAmC,EACnCC,KAAa,EACbC,MAA8B,EACP;EAAA,IAAAC,IAAA,EAAAC,qBAAA,CAAA;AACvB,EAA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AM,CAACE,OAAO,KAAdW,IAAAA,IAAAA,gBAAA,CAAgBC,MAAM,EAAE;AAC1B,QAAA,IAAIC,WAAW,GAAGf,MAAM,CAACE,OAAO,CAACI,OAAO,CAACN,MAAM,IAC7CA,MAAM,CAACU,cAAc,EACvB,CAAC,CAAA;QAED,OAAOE,YAAY,CAACG,WAAW,CAAC,CAAA;AAClC,OAAA;MAEA,OAAO,CAACf,MAAM,CAA0B,CAAA;KACzC,EACDQ,oBAAc,CAACnC,KAAK,CAACoC,OAAO,EAAE,cAAc,EAAE,uBAAuB,CACvE,CAAA;GACD,CAAA;AAED,EAAA,KAAK,MAAMO,OAAO,IAAI3C,KAAK,CAAC4C,SAAS,EAAE;IACrCD,OAAO,CAAC5C,YAAY,IAAA,IAAA,IAApB4C,OAAO,CAAC5C,YAAY,CAAG4B,MAAM,EAA2B3B,KAAK,CAAC,CAAA;AAChE,GAAA;;AAEA;AACA,EAAA,OAAO2B,MAAM,CAAA;AACf;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"headers.js","sources":["../../../src/core/headers.ts"],"sourcesContent":["import {\n RowData,\n Column,\n Header,\n HeaderGroup,\n Table,\n TableFeature,\n} from '../types'\nimport { getMemoOptions, memo } from '../utils'\n\nconst debug = 'debugHeaders'\n\nexport interface CoreHeaderGroup<TData extends RowData> {\n depth: number\n headers: Header<TData, unknown>[]\n id: string\n}\n\nexport interface HeaderContext<TData, TValue> {\n /**\n * An instance of a column.\n */\n column: Column<TData, TValue>\n /**\n * An instance of a header.\n */\n header: Header<TData, TValue>\n /**\n * The table instance.\n */\n table: Table<TData>\n}\n\nexport interface CoreHeader<TData extends RowData, TValue> {\n /**\n * The col-span for the header.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#colspan)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n colSpan: number\n /**\n * The header's associated column object.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#column)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n column: Column<TData, TValue>\n /**\n * The depth of the header, zero-indexed based.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#depth)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n depth: number\n /**\n * Returns the rendering context (or props) for column-based components like headers, footers and filters.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#getcontext)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getContext: () => HeaderContext<TData, TValue>\n /**\n * Returns the leaf headers hierarchically nested under this header.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#getleafheaders)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getLeafHeaders: () => Header<TData, unknown>[]\n /**\n * The header's associated header group object.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#headergroup)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n headerGroup: HeaderGroup<TData>\n /**\n * The unique identifier for the header.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#id)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n id: string\n /**\n * The index for the header within the header group.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#index)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n index: number\n /**\n * A boolean denoting if the header is a placeholder header.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#isplaceholder)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n isPlaceholder: boolean\n /**\n * If the header is a placeholder header, this will be a unique header ID that does not conflict with any other headers across the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#placeholderid)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n placeholderId?: string\n /**\n * The row-span for the header.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#rowspan)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n rowSpan: number\n /**\n * The header's hierarchical sub/child headers. Will be empty if the header's associated column is a leaf-column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#subheaders)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n subHeaders: Header<TData, TValue>[]\n}\n\nexport interface HeadersInstance<TData extends RowData> {\n /**\n * Returns all header groups for the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getheadergroups)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getHeaderGroups: () => HeaderGroup<TData>[]\n /**\n * If pinning, returns the header groups for the left pinned columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getleftheadergroups)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getLeftHeaderGroups: () => HeaderGroup<TData>[]\n /**\n * If pinning, returns the header groups for columns that are not pinned.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getcenterheadergroups)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getCenterHeaderGroups: () => HeaderGroup<TData>[]\n /**\n * If pinning, returns the header groups for the right pinned columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getrightheadergroups)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getRightHeaderGroups: () => HeaderGroup<TData>[]\n\n /**\n * Returns the footer groups for the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getfootergroups)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getFooterGroups: () => HeaderGroup<TData>[]\n /**\n * If pinning, returns the footer groups for the left pinned columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getleftfootergroups)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getLeftFooterGroups: () => HeaderGroup<TData>[]\n /**\n * If pinning, returns the footer groups for columns that are not pinned.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getcenterfootergroups)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getCenterFooterGroups: () => HeaderGroup<TData>[]\n /**\n * If pinning, returns the footer groups for the right pinned columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getrightfootergroups)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getRightFooterGroups: () => HeaderGroup<TData>[]\n\n /**\n * Returns headers for all columns in the table, including parent headers.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getflatheaders)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getFlatHeaders: () => Header<TData, unknown>[]\n /**\n * If pinning, returns headers for all left pinned columns in the table, including parent headers.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getleftflatheaders)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getLeftFlatHeaders: () => Header<TData, unknown>[]\n /**\n * If pinning, returns headers for all columns that are not pinned, including parent headers.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getcenterflatheaders)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getCenterFlatHeaders: () => Header<TData, unknown>[]\n /**\n * If pinning, returns headers for all right pinned columns in the table, including parent headers.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getrightflatheaders)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getRightFlatHeaders: () => Header<TData, unknown>[]\n\n /**\n * Returns headers for all leaf columns in the table, (not including parent headers).\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getleafheaders)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getLeafHeaders: () => Header<TData, unknown>[]\n /**\n * If pinning, returns headers for all left pinned leaf columns in the table, (not including parent headers).\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getleftleafheaders)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getLeftLeafHeaders: () => Header<TData, unknown>[]\n /**\n * If pinning, returns headers for all columns that are not pinned, (not including parent headers).\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getcenterleafheaders)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getCenterLeafHeaders: () => Header<TData, unknown>[]\n /**\n * If pinning, returns headers for all right pinned leaf columns in the table, (not including parent headers).\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getrightleafheaders)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getRightLeafHeaders: () => Header<TData, unknown>[]\n}\n\n//\n\nfunction createHeader<TData extends RowData, TValue>(\n table: Table<TData>,\n column: Column<TData, TValue>,\n options: {\n id?: string\n isPlaceholder?: boolean\n placeholderId?: string\n index: number\n depth: number\n }\n): Header<TData, TValue> {\n const id = options.id ?? column.id\n\n let header: CoreHeader<TData, TValue> = {\n id,\n column,\n index: options.index,\n isPlaceholder: !!options.isPlaceholder,\n placeholderId: options.placeholderId,\n depth: options.depth,\n subHeaders: [],\n colSpan: 0,\n rowSpan: 0,\n headerGroup: null!,\n getLeafHeaders: (): Header<TData, unknown>[] => {\n const leafHeaders: Header<TData, unknown>[] = []\n\n const recurseHeader = (h: CoreHeader<TData, any>) => {\n if (h.subHeaders && h.subHeaders.length) {\n h.subHeaders.map(recurseHeader)\n }\n leafHeaders.push(h as Header<TData, unknown>)\n }\n\n recurseHeader(header)\n\n return leafHeaders\n },\n getContext: () => ({\n table,\n header: header as Header<TData, TValue>,\n column,\n }),\n }\n\n table._features.forEach(feature => {\n feature.createHeader?.(header as Header<TData, TValue>, table)\n })\n\n return header as Header<TData, TValue>\n}\n\nexport const Headers: TableFeature = {\n createTable: <TData extends RowData>(table: Table<TData>): void => {\n // Header Groups\n\n table.getHeaderGroups = memo(\n () => [\n table.getAllColumns(),\n table.getVisibleLeafColumns(),\n table.getState().columnPinning.left,\n table.getState().columnPinning.right,\n ],\n (allColumns, leafColumns, left, right) => {\n const leftColumns =\n left\n ?.map(columnId => leafColumns.find(d => d.id === columnId)!)\n .filter(Boolean) ?? []\n\n const rightColumns =\n right\n ?.map(columnId => leafColumns.find(d => d.id === columnId)!)\n .filter(Boolean) ?? []\n\n const centerColumns = leafColumns.filter(\n column => !left?.includes(column.id) && !right?.includes(column.id)\n )\n\n const headerGroups = buildHeaderGroups(\n allColumns,\n [...leftColumns, ...centerColumns, ...rightColumns],\n table\n )\n\n return headerGroups\n },\n getMemoOptions(table.options, debug, 'getHeaderGroups')\n )\n\n table.getCenterHeaderGroups = memo(\n () => [\n table.getAllColumns(),\n table.getVisibleLeafColumns(),\n table.getState().columnPinning.left,\n table.getState().columnPinning.right,\n ],\n (allColumns, leafColumns, left, right) => {\n leafColumns = leafColumns.filter(\n column => !left?.includes(column.id) && !right?.includes(column.id)\n )\n return buildHeaderGroups(allColumns, leafColumns, table, 'center')\n },\n getMemoOptions(table.options, debug, 'getCenterHeaderGroups')\n )\n\n table.getLeftHeaderGroups = memo(\n () => [\n table.getAllColumns(),\n table.getVisibleLeafColumns(),\n table.getState().columnPinning.left,\n ],\n (allColumns, leafColumns, left) => {\n const orderedLeafColumns =\n left\n ?.map(columnId => leafColumns.find(d => d.id === columnId)!)\n .filter(Boolean) ?? []\n\n return buildHeaderGroups(allColumns, orderedLeafColumns, table, 'left')\n },\n getMemoOptions(table.options, debug, 'getLeftHeaderGroups')\n )\n\n table.getRightHeaderGroups = memo(\n () => [\n table.getAllColumns(),\n table.getVisibleLeafColumns(),\n table.getState().columnPinning.right,\n ],\n (allColumns, leafColumns, right) => {\n const orderedLeafColumns =\n right\n ?.map(columnId => leafColumns.find(d => d.id === columnId)!)\n .filter(Boolean) ?? []\n\n return buildHeaderGroups(allColumns, orderedLeafColumns, table, 'right')\n },\n getMemoOptions(table.options, debug, 'getRightHeaderGroups')\n )\n\n // Footer Groups\n\n table.getFooterGroups = memo(\n () => [table.getHeaderGroups()],\n headerGroups => {\n return [...headerGroups].reverse()\n },\n getMemoOptions(table.options, debug, 'getFooterGroups')\n )\n\n table.getLeftFooterGroups = memo(\n () => [table.getLeftHeaderGroups()],\n headerGroups => {\n return [...headerGroups].reverse()\n },\n getMemoOptions(table.options, debug, 'getLeftFooterGroups')\n )\n\n table.getCenterFooterGroups = memo(\n () => [table.getCenterHeaderGroups()],\n headerGroups => {\n return [...headerGroups].reverse()\n },\n getMemoOptions(table.options, debug, 'getCenterFooterGroups')\n )\n\n table.getRightFooterGroups = memo(\n () => [table.getRightHeaderGroups()],\n headerGroups => {\n return [...headerGroups].reverse()\n },\n getMemoOptions(table.options, debug, 'getRightFooterGroups')\n )\n\n // Flat Headers\n\n table.getFlatHeaders = memo(\n () => [table.getHeaderGroups()],\n headerGroups => {\n return headerGroups\n .map(headerGroup => {\n return headerGroup.headers\n })\n .flat()\n },\n getMemoOptions(table.options, debug, 'getFlatHeaders')\n )\n\n table.getLeftFlatHeaders = memo(\n () => [table.getLeftHeaderGroups()],\n left => {\n return left\n .map(headerGroup => {\n return headerGroup.headers\n })\n .flat()\n },\n getMemoOptions(table.options, debug, 'getLeftFlatHeaders')\n )\n\n table.getCenterFlatHeaders = memo(\n () => [table.getCenterHeaderGroups()],\n left => {\n return left\n .map(headerGroup => {\n return headerGroup.headers\n })\n .flat()\n },\n getMemoOptions(table.options, debug, 'getCenterFlatHeaders')\n )\n\n table.getRightFlatHeaders = memo(\n () => [table.getRightHeaderGroups()],\n left => {\n return left\n .map(headerGroup => {\n return headerGroup.headers\n })\n .flat()\n },\n getMemoOptions(table.options, debug, 'getRightFlatHeaders')\n )\n\n // Leaf Headers\n\n table.getCenterLeafHeaders = memo(\n () => [table.getCenterFlatHeaders()],\n flatHeaders => {\n return flatHeaders.filter(header => !header.subHeaders?.length)\n },\n getMemoOptions(table.options, debug, 'getCenterLeafHeaders')\n )\n\n table.getLeftLeafHeaders = memo(\n () => [table.getLeftFlatHeaders()],\n flatHeaders => {\n return flatHeaders.filter(header => !header.subHeaders?.length)\n },\n getMemoOptions(table.options, debug, 'getLeftLeafHeaders')\n )\n\n table.getRightLeafHeaders = memo(\n () => [table.getRightFlatHeaders()],\n flatHeaders => {\n return flatHeaders.filter(header => !header.subHeaders?.length)\n },\n getMemoOptions(table.options, debug, 'getRightLeafHeaders')\n )\n\n table.getLeafHeaders = memo(\n () => [\n table.getLeftHeaderGroups(),\n table.getCenterHeaderGroups(),\n table.getRightHeaderGroups(),\n ],\n (left, center, right) => {\n return [\n ...(left[0]?.headers ?? []),\n ...(center[0]?.headers ?? []),\n ...(right[0]?.headers ?? []),\n ]\n .map(header => {\n return header.getLeafHeaders()\n })\n .flat()\n },\n getMemoOptions(table.options, debug, 'getLeafHeaders')\n )\n },\n}\n\nexport function buildHeaderGroups<TData extends RowData>(\n allColumns: Column<TData, unknown>[],\n columnsToGroup: Column<TData, unknown>[],\n table: Table<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 = (columns: Column<TData, unknown>[], depth = 1) => {\n maxDepth = Math.max(maxDepth, depth)\n\n columns\n .filter(column => column.getIsVisible())\n .forEach(column => {\n if (column.columns?.length) {\n findMaxDepth(column.columns, depth + 1)\n }\n }, 0)\n }\n\n findMaxDepth(allColumns)\n\n let headerGroups: HeaderGroup<TData>[] = []\n\n const createHeaderGroup = (\n headersToGroup: Header<TData, unknown>[],\n depth: number\n ) => {\n // The header group we are creating\n const headerGroup: HeaderGroup<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: Header<TData, unknown>[] = []\n\n // Scan each column for parents\n headersToGroup.forEach(headerToGroup => {\n // What is the latest (last) parent column?\n\n const latestPendingParentHeader = [...pendingParentHeaders].reverse()[0]\n\n const isLeafHeader = headerToGroup.column.depth === headerGroup.depth\n\n let column: Column<TData, unknown>\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 = createHeader(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 createHeaderGroup(pendingParentHeaders, depth - 1)\n }\n }\n\n const bottomHeaders = columnsToGroup.map((column, index) =>\n createHeader(table, column, {\n depth: maxDepth,\n index,\n })\n )\n\n createHeaderGroup(bottomHeaders, maxDepth - 1)\n\n headerGroups.reverse()\n\n // headerGroups = headerGroups.filter(headerGroup => {\n // return !headerGroup.headers.every(header => header.isPlaceholder)\n // })\n\n const recurseHeadersForSpans = (\n headers: Header<TData, unknown>[]\n ): { colSpan: number; rowSpan: number }[] => {\n const filteredHeaders = headers.filter(header =>\n header.column.getIsVisible()\n )\n\n return filteredHeaders.map(header => {\n let colSpan = 0\n let rowSpan = 0\n let childRowSpans = [0]\n\n if (header.subHeaders && header.subHeaders.length) {\n childRowSpans = []\n\n recurseHeadersForSpans(header.subHeaders).forEach(\n ({ colSpan: childColSpan, rowSpan: childRowSpan }) => {\n colSpan += childColSpan\n childRowSpans.push(childRowSpan)\n }\n )\n } else {\n colSpan = 1\n }\n\n const minChildRowSpan = Math.min(...childRowSpans)\n rowSpan = rowSpan + minChildRowSpan\n\n header.colSpan = colSpan\n header.rowSpan = rowSpan\n\n return { colSpan, rowSpan }\n })\n }\n\n recurseHeadersForSpans(headerGroups[0]?.headers ?? [])\n\n return headerGroups\n}\n"],"names":["debug","createHeader","table","column","options","_options$id","id","header","index","isPlaceholder","placeholderId","depth","subHeaders","colSpan","rowSpan","headerGroup","getLeafHeaders","leafHeaders","recurseHeader","h","length","map","push","getContext","_features","forEach","feature","Headers","createTable","getHeaderGroups","memo","getAllColumns","getVisibleLeafColumns","getState","columnPinning","left","right","allColumns","leafColumns","_left$map$filter","_right$map$filter","leftColumns","columnId","find","d","filter","Boolean","rightColumns","centerColumns","includes","headerGroups","buildHeaderGroups","getMemoOptions","getCenterHeaderGroups","getLeftHeaderGroups","_left$map$filter2","orderedLeafColumns","getRightHeaderGroups","_right$map$filter2","getFooterGroups","reverse","getLeftFooterGroups","getCenterFooterGroups","getRightFooterGroups","getFlatHeaders","headers","flat","getLeftFlatHeaders","getCenterFlatHeaders","getRightFlatHeaders","getCenterLeafHeaders","flatHeaders","_header$subHeaders","getLeftLeafHeaders","_header$subHeaders2","getRightLeafHeaders","_header$subHeaders3","center","_left$0$headers","_left$","_center$0$headers","_center$","_right$0$headers","_right$","columnsToGroup","headerFamily","_headerGroups$0$heade","_headerGroups$","maxDepth","findMaxDepth","columns","Math","max","getIsVisible","_column$columns","createHeaderGroup","headersToGroup","join","pendingParentHeaders","headerToGroup","latestPendingParentHeader","isLeafHeader","parent","undefined","bottomHeaders","recurseHeadersForSpans","filteredHeaders","childRowSpans","_ref","childColSpan","childRowSpan","minChildRowSpan","min"],"mappings":";;;;;;;;;;;;;;AAUA,MAAMA,KAAK,GAAG,cAAc,CAAA;AAwM5B;;AAEA,SAASC,YAAYA,CACnBC,KAAmB,EACnBC,MAA6B,EAC7BC,OAMC,EACsB;AAAA,EAAA,IAAAC,WAAA,CAAA;AACvB,EAAA,MAAMC,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AS,CAAA;AAC7B,KAAC,CAAC,CAAA;GACH,CAAA;AAED2F,EAAAA,sBAAsB,EAAAnB,qBAAA,GAAA,CAAAC,cAAA,GAACrC,YAAY,CAAC,CAAC,CAAC,KAAA,IAAA,GAAA,KAAA,CAAA,GAAfqC,cAAA,CAAiBtB,OAAO,YAAAqB,qBAAA,GAAI,EAAE,CAAC,CAAA;AAEtD,EAAA,OAAOpC,YAAY,CAAA;AACrB;;;;;"}
1
+ {"version":3,"file":"headers.js","sources":["../../../src/core/headers.ts"],"sourcesContent":["import {\n RowData,\n Column,\n Header,\n HeaderGroup,\n Table,\n TableFeature,\n} from '../types'\nimport { getMemoOptions, memo } from '../utils'\n\nconst debug = 'debugHeaders'\n\nexport interface CoreHeaderGroup<TData extends RowData> {\n depth: number\n headers: Header<TData, unknown>[]\n id: string\n}\n\nexport interface HeaderContext<TData, TValue> {\n /**\n * An instance of a column.\n */\n column: Column<TData, TValue>\n /**\n * An instance of a header.\n */\n header: Header<TData, TValue>\n /**\n * The table instance.\n */\n table: Table<TData>\n}\n\nexport interface CoreHeader<TData extends RowData, TValue> {\n /**\n * The col-span for the header.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#colspan)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n colSpan: number\n /**\n * The header's associated column object.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#column)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n column: Column<TData, TValue>\n /**\n * The depth of the header, zero-indexed based.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#depth)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n depth: number\n /**\n * Returns the rendering context (or props) for column-based components like headers, footers and filters.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#getcontext)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getContext: () => HeaderContext<TData, TValue>\n /**\n * Returns the leaf headers hierarchically nested under this header.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#getleafheaders)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getLeafHeaders: () => Header<TData, unknown>[]\n /**\n * The header's associated header group object.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#headergroup)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n headerGroup: HeaderGroup<TData>\n /**\n * The unique identifier for the header.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#id)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n id: string\n /**\n * The index for the header within the header group.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#index)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n index: number\n /**\n * A boolean denoting if the header is a placeholder header.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#isplaceholder)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n isPlaceholder: boolean\n /**\n * If the header is a placeholder header, this will be a unique header ID that does not conflict with any other headers across the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#placeholderid)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n placeholderId?: string\n /**\n * The row-span for the header.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#rowspan)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n rowSpan: number\n /**\n * The header's hierarchical sub/child headers. Will be empty if the header's associated column is a leaf-column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#subheaders)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n subHeaders: Header<TData, TValue>[]\n}\n\nexport interface HeadersInstance<TData extends RowData> {\n /**\n * Returns all header groups for the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getheadergroups)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getHeaderGroups: () => HeaderGroup<TData>[]\n /**\n * If pinning, returns the header groups for the left pinned columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getleftheadergroups)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getLeftHeaderGroups: () => HeaderGroup<TData>[]\n /**\n * If pinning, returns the header groups for columns that are not pinned.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getcenterheadergroups)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getCenterHeaderGroups: () => HeaderGroup<TData>[]\n /**\n * If pinning, returns the header groups for the right pinned columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getrightheadergroups)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getRightHeaderGroups: () => HeaderGroup<TData>[]\n\n /**\n * Returns the footer groups for the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getfootergroups)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getFooterGroups: () => HeaderGroup<TData>[]\n /**\n * If pinning, returns the footer groups for the left pinned columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getleftfootergroups)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getLeftFooterGroups: () => HeaderGroup<TData>[]\n /**\n * If pinning, returns the footer groups for columns that are not pinned.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getcenterfootergroups)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getCenterFooterGroups: () => HeaderGroup<TData>[]\n /**\n * If pinning, returns the footer groups for the right pinned columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getrightfootergroups)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getRightFooterGroups: () => HeaderGroup<TData>[]\n\n /**\n * Returns headers for all columns in the table, including parent headers.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getflatheaders)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getFlatHeaders: () => Header<TData, unknown>[]\n /**\n * If pinning, returns headers for all left pinned columns in the table, including parent headers.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getleftflatheaders)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getLeftFlatHeaders: () => Header<TData, unknown>[]\n /**\n * If pinning, returns headers for all columns that are not pinned, including parent headers.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getcenterflatheaders)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getCenterFlatHeaders: () => Header<TData, unknown>[]\n /**\n * If pinning, returns headers for all right pinned columns in the table, including parent headers.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getrightflatheaders)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getRightFlatHeaders: () => Header<TData, unknown>[]\n\n /**\n * Returns headers for all leaf columns in the table, (not including parent headers).\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getleafheaders)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getLeafHeaders: () => Header<TData, unknown>[]\n /**\n * If pinning, returns headers for all left pinned leaf columns in the table, (not including parent headers).\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getleftleafheaders)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getLeftLeafHeaders: () => Header<TData, unknown>[]\n /**\n * If pinning, returns headers for all columns that are not pinned, (not including parent headers).\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getcenterleafheaders)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getCenterLeafHeaders: () => Header<TData, unknown>[]\n /**\n * If pinning, returns headers for all right pinned leaf columns in the table, (not including parent headers).\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getrightleafheaders)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getRightLeafHeaders: () => Header<TData, unknown>[]\n}\n\n//\n\nfunction createHeader<TData extends RowData, TValue>(\n table: Table<TData>,\n column: Column<TData, TValue>,\n options: {\n id?: string\n isPlaceholder?: boolean\n placeholderId?: string\n index: number\n depth: number\n }\n): Header<TData, TValue> {\n const id = options.id ?? column.id\n\n let header: CoreHeader<TData, TValue> = {\n id,\n column,\n index: options.index,\n isPlaceholder: !!options.isPlaceholder,\n placeholderId: options.placeholderId,\n depth: options.depth,\n subHeaders: [],\n colSpan: 0,\n rowSpan: 0,\n headerGroup: null!,\n getLeafHeaders: (): Header<TData, unknown>[] => {\n const leafHeaders: Header<TData, unknown>[] = []\n\n const recurseHeader = (h: CoreHeader<TData, any>) => {\n if (h.subHeaders && h.subHeaders.length) {\n h.subHeaders.map(recurseHeader)\n }\n leafHeaders.push(h as Header<TData, unknown>)\n }\n\n recurseHeader(header)\n\n return leafHeaders\n },\n getContext: () => ({\n table,\n header: header as Header<TData, TValue>,\n column,\n }),\n }\n\n table._features.forEach(feature => {\n feature.createHeader?.(header as Header<TData, TValue>, table)\n })\n\n return header as Header<TData, TValue>\n}\n\nexport const Headers: TableFeature = {\n createTable: <TData extends RowData>(table: Table<TData>): void => {\n // Header Groups\n\n table.getHeaderGroups = memo(\n () => [\n table.getAllColumns(),\n table.getVisibleLeafColumns(),\n table.getState().columnPinning.left,\n table.getState().columnPinning.right,\n ],\n (allColumns, leafColumns, left, right) => {\n const leftColumns =\n left\n ?.map(columnId => leafColumns.find(d => d.id === columnId)!)\n .filter(Boolean) ?? []\n\n const rightColumns =\n right\n ?.map(columnId => leafColumns.find(d => d.id === columnId)!)\n .filter(Boolean) ?? []\n\n const centerColumns = leafColumns.filter(\n column => !left?.includes(column.id) && !right?.includes(column.id)\n )\n\n const headerGroups = buildHeaderGroups(\n allColumns,\n [...leftColumns, ...centerColumns, ...rightColumns],\n table\n )\n\n return headerGroups\n },\n getMemoOptions(table.options, debug, 'getHeaderGroups')\n )\n\n table.getCenterHeaderGroups = memo(\n () => [\n table.getAllColumns(),\n table.getVisibleLeafColumns(),\n table.getState().columnPinning.left,\n table.getState().columnPinning.right,\n ],\n (allColumns, leafColumns, left, right) => {\n leafColumns = leafColumns.filter(\n column => !left?.includes(column.id) && !right?.includes(column.id)\n )\n return buildHeaderGroups(allColumns, leafColumns, table, 'center')\n },\n getMemoOptions(table.options, debug, 'getCenterHeaderGroups')\n )\n\n table.getLeftHeaderGroups = memo(\n () => [\n table.getAllColumns(),\n table.getVisibleLeafColumns(),\n table.getState().columnPinning.left,\n ],\n (allColumns, leafColumns, left) => {\n const orderedLeafColumns =\n left\n ?.map(columnId => leafColumns.find(d => d.id === columnId)!)\n .filter(Boolean) ?? []\n\n return buildHeaderGroups(allColumns, orderedLeafColumns, table, 'left')\n },\n getMemoOptions(table.options, debug, 'getLeftHeaderGroups')\n )\n\n table.getRightHeaderGroups = memo(\n () => [\n table.getAllColumns(),\n table.getVisibleLeafColumns(),\n table.getState().columnPinning.right,\n ],\n (allColumns, leafColumns, right) => {\n const orderedLeafColumns =\n right\n ?.map(columnId => leafColumns.find(d => d.id === columnId)!)\n .filter(Boolean) ?? []\n\n return buildHeaderGroups(allColumns, orderedLeafColumns, table, 'right')\n },\n getMemoOptions(table.options, debug, 'getRightHeaderGroups')\n )\n\n // Footer Groups\n\n table.getFooterGroups = memo(\n () => [table.getHeaderGroups()],\n headerGroups => {\n return [...headerGroups].reverse()\n },\n getMemoOptions(table.options, debug, 'getFooterGroups')\n )\n\n table.getLeftFooterGroups = memo(\n () => [table.getLeftHeaderGroups()],\n headerGroups => {\n return [...headerGroups].reverse()\n },\n getMemoOptions(table.options, debug, 'getLeftFooterGroups')\n )\n\n table.getCenterFooterGroups = memo(\n () => [table.getCenterHeaderGroups()],\n headerGroups => {\n return [...headerGroups].reverse()\n },\n getMemoOptions(table.options, debug, 'getCenterFooterGroups')\n )\n\n table.getRightFooterGroups = memo(\n () => [table.getRightHeaderGroups()],\n headerGroups => {\n return [...headerGroups].reverse()\n },\n getMemoOptions(table.options, debug, 'getRightFooterGroups')\n )\n\n // Flat Headers\n\n table.getFlatHeaders = memo(\n () => [table.getHeaderGroups()],\n headerGroups => {\n return headerGroups\n .map(headerGroup => {\n return headerGroup.headers\n })\n .flat()\n },\n getMemoOptions(table.options, debug, 'getFlatHeaders')\n )\n\n table.getLeftFlatHeaders = memo(\n () => [table.getLeftHeaderGroups()],\n left => {\n return left\n .map(headerGroup => {\n return headerGroup.headers\n })\n .flat()\n },\n getMemoOptions(table.options, debug, 'getLeftFlatHeaders')\n )\n\n table.getCenterFlatHeaders = memo(\n () => [table.getCenterHeaderGroups()],\n left => {\n return left\n .map(headerGroup => {\n return headerGroup.headers\n })\n .flat()\n },\n getMemoOptions(table.options, debug, 'getCenterFlatHeaders')\n )\n\n table.getRightFlatHeaders = memo(\n () => [table.getRightHeaderGroups()],\n left => {\n return left\n .map(headerGroup => {\n return headerGroup.headers\n })\n .flat()\n },\n getMemoOptions(table.options, debug, 'getRightFlatHeaders')\n )\n\n // Leaf Headers\n\n table.getCenterLeafHeaders = memo(\n () => [table.getCenterFlatHeaders()],\n flatHeaders => {\n return flatHeaders.filter(header => !header.subHeaders?.length)\n },\n getMemoOptions(table.options, debug, 'getCenterLeafHeaders')\n )\n\n table.getLeftLeafHeaders = memo(\n () => [table.getLeftFlatHeaders()],\n flatHeaders => {\n return flatHeaders.filter(header => !header.subHeaders?.length)\n },\n getMemoOptions(table.options, debug, 'getLeftLeafHeaders')\n )\n\n table.getRightLeafHeaders = memo(\n () => [table.getRightFlatHeaders()],\n flatHeaders => {\n return flatHeaders.filter(header => !header.subHeaders?.length)\n },\n getMemoOptions(table.options, debug, 'getRightLeafHeaders')\n )\n\n table.getLeafHeaders = memo(\n () => [\n table.getLeftHeaderGroups(),\n table.getCenterHeaderGroups(),\n table.getRightHeaderGroups(),\n ],\n (left, center, right) => {\n return [\n ...(left[0]?.headers ?? []),\n ...(center[0]?.headers ?? []),\n ...(right[0]?.headers ?? []),\n ]\n .map(header => {\n return header.getLeafHeaders()\n })\n .flat()\n },\n getMemoOptions(table.options, debug, 'getLeafHeaders')\n )\n },\n}\n\nexport function buildHeaderGroups<TData extends RowData>(\n allColumns: Column<TData, unknown>[],\n columnsToGroup: Column<TData, unknown>[],\n table: Table<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 = (columns: Column<TData, unknown>[], depth = 1) => {\n maxDepth = Math.max(maxDepth, depth)\n\n columns\n .filter(column => column.getIsVisible())\n .forEach(column => {\n if (column.columns?.length) {\n findMaxDepth(column.columns, depth + 1)\n }\n }, 0)\n }\n\n findMaxDepth(allColumns)\n\n let headerGroups: HeaderGroup<TData>[] = []\n\n const createHeaderGroup = (\n headersToGroup: Header<TData, unknown>[],\n depth: number\n ) => {\n // The header group we are creating\n const headerGroup: HeaderGroup<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: Header<TData, unknown>[] = []\n\n // Scan each column for parents\n headersToGroup.forEach(headerToGroup => {\n // What is the latest (last) parent column?\n\n const latestPendingParentHeader = [...pendingParentHeaders].reverse()[0]\n\n const isLeafHeader = headerToGroup.column.depth === headerGroup.depth\n\n let column: Column<TData, unknown>\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 = createHeader(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 createHeaderGroup(pendingParentHeaders, depth - 1)\n }\n }\n\n const bottomHeaders = columnsToGroup.map((column, index) =>\n createHeader(table, column, {\n depth: maxDepth,\n index,\n })\n )\n\n createHeaderGroup(bottomHeaders, maxDepth - 1)\n\n headerGroups.reverse()\n\n // headerGroups = headerGroups.filter(headerGroup => {\n // return !headerGroup.headers.every(header => header.isPlaceholder)\n // })\n\n const recurseHeadersForSpans = (\n headers: Header<TData, unknown>[]\n ): { colSpan: number; rowSpan: number }[] => {\n const filteredHeaders = headers.filter(header =>\n header.column.getIsVisible()\n )\n\n return filteredHeaders.map(header => {\n let colSpan = 0\n let rowSpan = 0\n let childRowSpans = [0]\n\n if (header.subHeaders && header.subHeaders.length) {\n childRowSpans = []\n\n recurseHeadersForSpans(header.subHeaders).forEach(\n ({ colSpan: childColSpan, rowSpan: childRowSpan }) => {\n colSpan += childColSpan\n childRowSpans.push(childRowSpan)\n }\n )\n } else {\n colSpan = 1\n }\n\n const minChildRowSpan = Math.min(...childRowSpans)\n rowSpan = rowSpan + minChildRowSpan\n\n header.colSpan = colSpan\n header.rowSpan = rowSpan\n\n return { colSpan, rowSpan }\n })\n }\n\n recurseHeadersForSpans(headerGroups[0]?.headers ?? [])\n\n return headerGroups\n}\n"],"names":["debug","createHeader","table","column","options","_options$id","id","header","index","isPlaceholder","placeholderId","depth","subHeaders","colSpan","rowSpan","headerGroup","getLeafHeaders","leafHeaders","recurseHeader","h","length","map","push","getContext","_features","forEach","feature","Headers","createTable","getHeaderGroups","memo","getAllColumns","getVisibleLeafColumns","getState","columnPinning","left","right","allColumns","leafColumns","_left$map$filter","_right$map$filter","leftColumns","columnId","find","d","filter","Boolean","rightColumns","centerColumns","includes","headerGroups","buildHeaderGroups","getMemoOptions","getCenterHeaderGroups","getLeftHeaderGroups","_left$map$filter2","orderedLeafColumns","getRightHeaderGroups","_right$map$filter2","getFooterGroups","reverse","getLeftFooterGroups","getCenterFooterGroups","getRightFooterGroups","getFlatHeaders","headers","flat","getLeftFlatHeaders","getCenterFlatHeaders","getRightFlatHeaders","getCenterLeafHeaders","flatHeaders","_header$subHeaders","getLeftLeafHeaders","_header$subHeaders2","getRightLeafHeaders","_header$subHeaders3","center","_left$0$headers","_left$","_center$0$headers","_center$","_right$0$headers","_right$","columnsToGroup","headerFamily","_headerGroups$0$heade","_headerGroups$","maxDepth","findMaxDepth","columns","Math","max","getIsVisible","_column$columns","createHeaderGroup","headersToGroup","join","pendingParentHeaders","headerToGroup","latestPendingParentHeader","isLeafHeader","parent","undefined","bottomHeaders","recurseHeadersForSpans","filteredHeaders","childRowSpans","_ref","childColSpan","childRowSpan","minChildRowSpan","min"],"mappings":";;;;;;;;;;;;;;AAUA,MAAMA,KAAK,GAAG,cAAc,CAAA;AAwM5B;;AAEA,SAASC,YAAYA,CACnBC,KAAmB,EACnBC,MAA6B,EAC7BC,OAMC,EACsB;AAAA,EAAA,IAAAC,WAAA,CAAA;AACvB,EAAA,MAAMC,EAAE,GAAA,CAAAD,WAAA,GAAGD,OAAO,CAACE,EAAE,KAAA,IAAA,GAAAD,WAAA,GAAIF,MAAM,CAACG,EAAE,CAAA;AAElC,EAAA,IAAIC,MAAiC,GAAG;IACtCD,EAAE;IACFH,MAAM;IACNK,KAAK,EAAEJ,OAAO,CAACI,KAAK;AACpBC,IAAAA,aAAa,EAAE,CAAC,CAACL,OAAO,CAACK,aAAa;IACtCC,aAAa,EAAEN,OAAO,CAACM,aAAa;IACpCC,KAAK,EAAEP,OAAO,CAACO,KAAK;AACpB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cesContent":["import { functionalUpdate, getMemoOptions, memo, RequiredKeys } from '../utils'\n\nimport {\n Updater,\n TableOptionsResolved,\n TableState,\n Table,\n InitialTableState,\n Row,\n Column,\n RowModel,\n ColumnDef,\n TableOptions,\n RowData,\n TableMeta,\n ColumnDefResolved,\n GroupColumnDef,\n TableFeature,\n} from '../types'\n\n//\nimport { createColumn } from './column'\nimport { Headers } from './headers'\n//\n\nimport { ColumnFaceting } from '../features/ColumnFaceting'\nimport { ColumnFiltering } from '../features/ColumnFiltering'\nimport { ColumnGrouping } from '../features/ColumnGrouping'\nimport { ColumnOrdering } from '../features/ColumnOrdering'\nimport { ColumnPinning } from '../features/ColumnPinning'\nimport { ColumnSizing } from '../features/ColumnSizing'\nimport { ColumnVisibility } from '../features/ColumnVisibility'\nimport { GlobalFaceting } from '../features/GlobalFaceting'\nimport { GlobalFiltering } from '../features/GlobalFiltering'\nimport { RowExpanding } from '../features/RowExpanding'\nimport { RowPagination } from '../features/RowPagination'\nimport { RowPinning } from '../features/RowPinning'\nimport { RowSelection } from '../features/RowSelection'\nimport { RowSorting } from '../features/RowSorting'\n\nconst builtInFeatures = [\n Headers,\n ColumnVisibility,\n ColumnOrdering,\n ColumnPinning,\n ColumnFaceting,\n ColumnFiltering,\n GlobalFaceting, //depends on ColumnFaceting\n GlobalFiltering, //depends on ColumnFiltering\n RowSorting,\n ColumnGrouping, //depends on RowSorting\n RowExpanding,\n RowPagination,\n RowPinning,\n RowSelection,\n ColumnSizing,\n] as const\n\n//\n\nexport interface CoreTableState {}\n\nexport interface CoreOptions<TData extends RowData> {\n /**\n * An array of extra features that you can add to the table instance.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#_features)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n _features?: TableFeature[]\n /**\n * Set this option to override any of the `autoReset...` feature options.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#autoresetall)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n autoResetAll?: boolean\n /**\n * The array of column defs to use for the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#columns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n columns: ColumnDef<TData, any>[]\n /**\n * The data for the table to display. This array should match the type you provided to `table.setRowType<...>`. Columns can access this data via string/index or a functional accessor. When the `data` option changes reference, the table will reprocess the data.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#data)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n data: TData[]\n /**\n * Set this option to `true` to output all debugging information to the console.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#debugall)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n debugAll?: boolean\n /**\n * Set this option to `true` to output cell debugging information to the console.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#debugcells]\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n debugCells?: boolean\n /**\n * Set this option to `true` to output column debugging information to the console.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#debugcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n debugColumns?: boolean\n /**\n * Set this option to `true` to output header debugging information to the console.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#debugheaders)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n debugHeaders?: boolean\n /**\n * Set this option to `true` to output row debugging information to the console.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#debugrows)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n debugRows?: boolean\n /**\n * Set this option to `true` to output table debugging information to the console.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#debugtable)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n debugTable?: boolean\n /**\n * Default column options to use for all column defs supplied to the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#defaultcolumn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n defaultColumn?: Partial<ColumnDef<TData, unknown>>\n /**\n * This required option is a factory for a function that computes and returns the core row model for the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getcorerowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getCoreRowModel: (table: Table<any>) => () => RowModel<any>\n /**\n * 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.\n * @example getRowId: row => row.userId\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getrowid)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getRowId?: (originalRow: TData, index: number, parent?: Row<TData>) => string\n /**\n * 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.\n * @example getSubRows: row => row.subRows\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getsubrows)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getSubRows?: (originalRow: TData, index: number) => undefined | TData[]\n /**\n * 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.\n *\n * Table state will not be reset when this object changes, which also means that the initial state object does not need to be stable.\n *\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#initialstate)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n initialState?: InitialTableState\n /**\n * This option is used to optionally implement the merging of table options.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#mergeoptions)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n mergeOptions?: (\n defaultOptions: TableOptions<TData>,\n options: Partial<TableOptions<TData>>\n ) => TableOptions<TData>\n /**\n * You can pass any object to `options.meta` and access it anywhere the `table` is available via `table.options.meta`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#meta)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n meta?: TableMeta<TData>\n /**\n * The `onStateChange` option can be used to optionally listen to state changes within the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#onstatechange)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n onStateChange: (updater: Updater<TableState>) => void\n /**\n * Value used when the desired value is not found in the data.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#renderfallbackvalue)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n renderFallbackValue: any\n /**\n * The `state` option can be used to optionally _control_ part or all of the table state. The state you pass here will merge with and overwrite the internal automatically-managed state to produce the final state for the table. You can also listen to state changes via the `onStateChange` option.\n * > Note: Any state passed in here will override both the internal state and any other `initialState` you provide.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#state)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n state: Partial<TableState>\n}\n\nexport interface CoreInstance<TData extends RowData> {\n _features: readonly TableFeature[]\n _getAllFlatColumnsById: () => Record<string, Column<TData, unknown>>\n _getColumnDefs: () => ColumnDef<TData, unknown>[]\n _getCoreRowModel?: () => RowModel<TData>\n _getDefaultColumnDef: () => Partial<ColumnDef<TData, unknown>>\n _getRowId: (_: TData, index: number, parent?: Row<TData>) => string\n _queue: (cb: () => void) => void\n /**\n * Returns all columns in the table in their normalized and nested hierarchy.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getallcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getAllColumns: () => Column<TData, unknown>[]\n /**\n * Returns all columns in the table flattened to a single level.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getallflatcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getAllFlatColumns: () => Column<TData, unknown>[]\n /**\n * Returns all leaf-node columns in the table flattened to a single level. This does not include parent columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getallleafcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getAllLeafColumns: () => Column<TData, unknown>[]\n /**\n * Returns a single column by its ID.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getcolumn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getColumn: (columnId: string) => Column<TData, unknown> | undefined\n /**\n * Returns the core row model before any processing has been applied.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getcorerowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getCoreRowModel: () => RowModel<TData>\n /**\n * Returns the row with the given ID.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getrow)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getRow: (id: string, searchAll?: boolean) => Row<TData>\n /**\n * Returns the final model after all processing from other used features has been applied. This is the row model that is most commonly used for rendering.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getRowModel: () => RowModel<TData>\n /**\n * Call this function to get the table's current state. It's recommended to use this function and its state, especially when managing the table state manually. It is the exact same state used internally by the table for every feature and function it provides.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getstate)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getState: () => TableState\n /**\n * This is the resolved initial state of the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#initialstate)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n initialState: TableState\n /**\n * A read-only reference to the table's current options.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#options)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n options: RequiredKeys<TableOptionsResolved<TData>, 'state'>\n /**\n * Call this function to reset the table state to the initial state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#reset)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n reset: () => void\n /**\n * This function can be used to update the table options.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#setoptions)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n setOptions: (newOptions: Updater<TableOptionsResolved<TData>>) => void\n /**\n * Call this function to update the table state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#setstate)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n setState: (updater: Updater<TableState>) => void\n}\n\nexport function createTable<TData extends RowData>(\n options: TableOptionsResolved<TData>\n): Table<TData> {\n if (\n process.env.NODE_ENV !== 'production' &&\n (options.debugAll || options.debugTable)\n ) {\n console.info('Creating Table Instance...')\n }\n\n const _features = [...builtInFeatures, ...(options._features ?? [])]\n\n let table = { _features } as unknown as Table<TData>\n\n const defaultOptions = table._features.reduce((obj, feature) => {\n return Object.assign(obj, feature.getDefaultOptions?.(table))\n }, {}) as TableOptionsResolved<TData>\n\n const mergeOptions = (options: TableOptionsResolved<TData>) => {\n if (table.options.mergeOptions) {\n return table.options.mergeOptions(defaultOptions, options)\n }\n\n return {\n ...defaultOptions,\n ...options,\n }\n }\n\n const coreInitialState: CoreTableState = {}\n\n let initialState = {\n ...coreInitialState,\n ...(options.initialState ?? {}),\n } as TableState\n\n table._features.forEach(feature => {\n initialState = (feature.getInitialState?.(initialState) ??\n initialState) as TableState\n })\n\n const queued: (() => void)[] = []\n let queuedTimeout = false\n\n const coreInstance: CoreInstance<TData> = {\n _features,\n options: {\n ...defaultOptions,\n ...options,\n },\n initialState,\n _queue: cb => {\n queued.push(cb)\n\n if (!queuedTimeout) {\n queuedTimeout = true\n\n // Schedule a microtask to run the queued callbacks after\n // the current call stack (render, etc) has finished.\n Promise.resolve()\n .then(() => {\n while (queued.length) {\n queued.shift()!()\n }\n queuedTimeout = false\n })\n .catch(error =>\n setTimeout(() => {\n throw error\n })\n )\n }\n },\n reset: () => {\n table.setState(table.initialState)\n },\n setOptions: updater => {\n const newOptions = functionalUpdate(updater, table.options)\n table.options = mergeOptions(newOptions) as RequiredKeys<\n TableOptionsResolved<TData>,\n 'state'\n >\n },\n\n getState: () => {\n return table.options.state as TableState\n },\n\n setState: (updater: Updater<TableState>) => {\n table.options.onStateChange?.(updater)\n },\n\n _getRowId: (row: TData, index: number, parent?: Row<TData>) =>\n table.options.getRowId?.(row, index, parent) ??\n `${parent ? [parent.id, index].join('.') : index}`,\n\n getCoreRowModel: () => {\n if (!table._getCoreRowModel) {\n table._getCoreRowModel = table.options.getCoreRowModel(table)\n }\n\n return table._getCoreRowModel!()\n },\n\n // The final calls start at the bottom of the model,\n // expanded rows, which then work their way up\n\n getRowModel: () => {\n return table.getPaginationRowModel()\n },\n //in next version, we should just pass in the row model as the optional 2nd arg\n getRow: (id: string, searchAll?: boolean) => {\n let row = (\n searchAll ? table.getPrePaginationRowModel() : table.getRowModel()\n ).rowsById[id]\n\n if (!row) {\n row = table.getCoreRowModel().rowsById[id]\n if (!row) {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(`getRow could not find row with ID: ${id}`)\n }\n throw new Error()\n }\n }\n\n return row\n },\n _getDefaultColumnDef: memo(\n () => [table.options.defaultColumn],\n defaultColumn => {\n defaultColumn = (defaultColumn ?? {}) as Partial<\n ColumnDef<TData, unknown>\n >\n\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 // footer: props => props.header.column.id,\n cell: props => props.renderValue<any>()?.toString?.() ?? null,\n ...table._features.reduce((obj, feature) => {\n return Object.assign(obj, feature.getDefaultColumnDef?.())\n }, {}),\n ...defaultColumn,\n } as Partial<ColumnDef<TData, unknown>>\n },\n getMemoOptions(options, 'debugColumns', '_getDefaultColumnDef')\n ),\n\n _getColumnDefs: () => table.options.columns,\n\n getAllColumns: memo(\n () => [table._getColumnDefs()],\n columnDefs => {\n const recurseColumns = (\n columnDefs: ColumnDef<TData, unknown>[],\n parent?: Column<TData, unknown>,\n depth = 0\n ): Column<TData, unknown>[] => {\n return columnDefs.map(columnDef => {\n const column = createColumn(table, columnDef, depth, parent)\n\n const groupingColumnDef = columnDef as GroupColumnDef<\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(columnDefs)\n },\n getMemoOptions(options, 'debugColumns', 'getAllColumns')\n ),\n\n getAllFlatColumns: memo(\n () => [table.getAllColumns()],\n allColumns => {\n return allColumns.flatMap(column => {\n return column.getFlatColumns()\n })\n },\n getMemoOptions(options, 'debugColumns', 'getAllFlatColumns')\n ),\n\n _getAllFlatColumnsById: memo(\n () => [table.getAllFlatColumns()],\n flatColumns => {\n return flatColumns.reduce(\n (acc, column) => {\n acc[column.id] = column\n return acc\n },\n {} as Record<string, Column<TData, unknown>>\n )\n },\n getMemoOptions(options, 'debugColumns', 'getAllFlatColumnsById')\n ),\n\n getAllLeafColumns: memo(\n () => [table.getAllColumns(), table._getOrderColumnsFn()],\n (allColumns, orderColumns) => {\n let leafColumns = allColumns.flatMap(column => column.getLeafColumns())\n return orderColumns(leafColumns)\n },\n getMemoOptions(options, 'debugColumns', 'getAllLeafColumns')\n ),\n\n getColumn: columnId => {\n const column = table._getAllFlatColumnsById()[columnId]\n\n if (process.env.NODE_ENV !== 'production' && !column) {\n console.error(`[Table] Column with id '${columnId}' does not exist.`)\n }\n\n return column\n },\n }\n\n Object.assign(table, coreInstance)\n\n for (let index = 0; index < table._features.length; index++) {\n const feature = table._features[index]\n feature?.createTable?.(table)\n }\n\n return table\n}\n"],"names":["builtInFeatures","Headers","ColumnVisibility","ColumnOrdering","ColumnPinning","ColumnFaceting","ColumnFiltering","GlobalFaceting","GlobalFiltering","RowSorting","ColumnGrouping","RowExpanding","RowPagination","RowPinning","RowSelection","ColumnSizing","createTable","options","_options$_features","_options$initialState","process","env","NODE_ENV","debugAll","debugTable","console","info","_features","table","defaultOptions","reduce","obj","feature","Object","assign","getDefaultOptions","mergeOptions","coreInitialState","initialState","forEach","_feature$getInitialSt","getInitialState","queued","queuedTimeout","coreInstance","_queue","cb","push","Promise","resolve","then","length","shift","catch","error","setTimeout","reset","setState","setOptions","updater","newOptions","functionalUpdate","getState","state","onStateChange","_getRowId","row","index","parent","_table$options$getRow","getRowId","id","join","getCoreRowModel","_getCoreRowModel","getRowModel","getPaginationRowModel","getRow","searchAll","getPrePaginationRowModel","rowsById","Error","_getDefaultColumnDef","memo","defaultColumn","_defaultColumn","header","props","resolvedColumnDef","column","columnDef","accessorKey","accessorFn","cell","_props$renderValue$to","_props$renderValue","renderValue","toString","getDefaultColumnDef","getMemoOptions","_getColumnDefs","columns","getAllColumns","columnDefs","recurseColumns","depth","map","createColumn","groupingColumnDef","getAllFlatColumns","allColumns","flatMap","getFlatColumns","_getAllFlatColumnsById","flatColumns","acc","getAllLeafColumns","_getOrderColumnsFn","orderColumns","leafColumns","getLeafColumns","getColumn","columnId"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCA,MAAMA,eAAe,GAAG,CACtBC,eAAO,EACPC,iCAAgB,EAChBC,6BAAc,EACdC,2BAAa,EACbC,6BAAc,EACdC,+BAAe,EACfC,6BAAc;AAAE;AAChBC,+BAAe;AAAE;AACjBC,qBAAU,EACVC,6BAAc;AAAE;AAChBC,yBAAY,EACZC,2BAAa,EACbC,qBAAU,EACVC,yBAAY,EACZC,yBAAY,CACJ,CAAA;;AAEV;;AAgOO,SAASC,WAAWA,CACzBC,OAAoC,EACt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MACvE,OAAOF,YAAY,CAACC,WAAW,CAAC,CAAA;KACjC,EACDpB,oBAAc,CAAClF,OAAO,EAAE,cAAc,EAAE,mBAAmB,CAC7D,CAAC;IAEDwG,SAAS,EAAEC,QAAQ,IAAI;MACrB,MAAMjC,MAAM,GAAG7D,KAAK,CAACqF,sBAAsB,EAAE,CAACS,QAAQ,CAAC,CAAA;MAEvD,IAAItG,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,IAAI,CAACmE,MAAM,EAAE;AACpDhE,QAAAA,OAAO,CAAC6B,KAAK,CAAE,CAA0BoE,wBAAAA,EAAAA,QAAS,mBAAkB,CAAC,CAAA;AACvE,OAAA;AAEA,MAAA,OAAOjC,MAAM,CAAA;AACf,KAAA;GACD,CAAA;AAEDxD,EAAAA,MAAM,CAACC,MAAM,CAACN,KAAK,EAAEgB,YAAY,CAAC,CAAA;AAElC,EAAA,KAAK,IAAIuB,KAAK,GAAG,CAAC,EAAEA,KAAK,GAAGvC,KAAK,CAACD,SAAS,CAACwB,MAAM,EAAEgB,KAAK,EAAE,EAAE;AAC3D,IAAA,MAAMnC,OAAO,GAAGJ,KAAK,CAACD,SAAS,CAACwC,KAAK,CAAC,CAAA;IACtCnC,OAAO,IAAA,IAAA,IAAPA,OAAO,CAAEhB,WAAW,IAAA,IAAA,IAApBgB,OAAO,CAAEhB,WAAW,CAAGY,KAAK,CAAC,CAAA;AAC/B,GAAA;AAEA,EAAA,OAAOA,KAAK,CAAA;AACd;;;;"}
1
+ {"version":3,"file":"table.js","sources":["../../../src/core/table.ts"],"sourcesContent":["import { functionalUpdate, getMemoOptions, memo, RequiredKeys } from '../utils'\n\nimport {\n Updater,\n TableOptionsResolved,\n TableState,\n Table,\n InitialTableState,\n Row,\n Column,\n RowModel,\n ColumnDef,\n TableOptions,\n RowData,\n TableMeta,\n ColumnDefResolved,\n GroupColumnDef,\n TableFeature,\n} from '../types'\n\n//\nimport { createColumn } from './column'\nimport { Headers } from './headers'\n//\n\nimport { ColumnFaceting } from '../features/ColumnFaceting'\nimport { ColumnFiltering } from '../features/ColumnFiltering'\nimport { ColumnGrouping } from '../features/ColumnGrouping'\nimport { ColumnOrdering } from '../features/ColumnOrdering'\nimport { ColumnPinning } from '../features/ColumnPinning'\nimport { ColumnSizing } from '../features/ColumnSizing'\nimport { ColumnVisibility } from '../features/ColumnVisibility'\nimport { GlobalFaceting } from '../features/GlobalFaceting'\nimport { GlobalFiltering } from '../features/GlobalFiltering'\nimport { RowExpanding } from '../features/RowExpanding'\nimport { RowPagination } from '../features/RowPagination'\nimport { RowPinning } from '../features/RowPinning'\nimport { RowSelection } from '../features/RowSelection'\nimport { RowSorting } from '../features/RowSorting'\n\nconst builtInFeatures = [\n Headers,\n ColumnVisibility,\n ColumnOrdering,\n ColumnPinning,\n ColumnFaceting,\n ColumnFiltering,\n GlobalFaceting, //depends on ColumnFaceting\n GlobalFiltering, //depends on ColumnFiltering\n RowSorting,\n ColumnGrouping, //depends on RowSorting\n RowExpanding,\n RowPagination,\n RowPinning,\n RowSelection,\n ColumnSizing,\n] as const\n\n//\n\nexport interface CoreTableState {}\n\nexport interface CoreOptions<TData extends RowData> {\n /**\n * An array of extra features that you can add to the table instance.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#_features)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n _features?: TableFeature[]\n /**\n * Set this option to override any of the `autoReset...` feature options.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#autoresetall)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n autoResetAll?: boolean\n /**\n * The array of column defs to use for the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#columns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n columns: ColumnDef<TData, any>[]\n /**\n * The data for the table to display. This array should match the type you provided to `table.setRowType<...>`. Columns can access this data via string/index or a functional accessor. When the `data` option changes reference, the table will reprocess the data.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#data)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n data: TData[]\n /**\n * Set this option to `true` to output all debugging information to the console.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#debugall)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n debugAll?: boolean\n /**\n * Set this option to `true` to output cell debugging information to the console.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#debugcells]\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n debugCells?: boolean\n /**\n * Set this option to `true` to output column debugging information to the console.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#debugcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n debugColumns?: boolean\n /**\n * Set this option to `true` to output header debugging information to the console.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#debugheaders)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n debugHeaders?: boolean\n /**\n * Set this option to `true` to output row debugging information to the console.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#debugrows)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n debugRows?: boolean\n /**\n * Set this option to `true` to output table debugging information to the console.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#debugtable)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n debugTable?: boolean\n /**\n * Default column options to use for all column defs supplied to the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#defaultcolumn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n defaultColumn?: Partial<ColumnDef<TData, unknown>>\n /**\n * This required option is a factory for a function that computes and returns the core row model for the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getcorerowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getCoreRowModel: (table: Table<any>) => () => RowModel<any>\n /**\n * 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.\n * @example getRowId: row => row.userId\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getrowid)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getRowId?: (originalRow: TData, index: number, parent?: Row<TData>) => string\n /**\n * 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.\n * @example getSubRows: row => row.subRows\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getsubrows)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getSubRows?: (originalRow: TData, index: number) => undefined | TData[]\n /**\n * 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.\n *\n * Table state will not be reset when this object changes, which also means that the initial state object does not need to be stable.\n *\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#initialstate)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n initialState?: InitialTableState\n /**\n * This option is used to optionally implement the merging of table options.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#mergeoptions)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n mergeOptions?: (\n defaultOptions: TableOptions<TData>,\n options: Partial<TableOptions<TData>>\n ) => TableOptions<TData>\n /**\n * You can pass any object to `options.meta` and access it anywhere the `table` is available via `table.options.meta`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#meta)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n meta?: TableMeta<TData>\n /**\n * The `onStateChange` option can be used to optionally listen to state changes within the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#onstatechange)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n onStateChange: (updater: Updater<TableState>) => void\n /**\n * Value used when the desired value is not found in the data.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#renderfallbackvalue)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n renderFallbackValue: any\n /**\n * The `state` option can be used to optionally _control_ part or all of the table state. The state you pass here will merge with and overwrite the internal automatically-managed state to produce the final state for the table. You can also listen to state changes via the `onStateChange` option.\n * > Note: Any state passed in here will override both the internal state and any other `initialState` you provide.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#state)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n state: Partial<TableState>\n}\n\nexport interface CoreInstance<TData extends RowData> {\n _features: readonly TableFeature[]\n _getAllFlatColumnsById: () => Record<string, Column<TData, unknown>>\n _getColumnDefs: () => ColumnDef<TData, unknown>[]\n _getCoreRowModel?: () => RowModel<TData>\n _getDefaultColumnDef: () => Partial<ColumnDef<TData, unknown>>\n _getRowId: (_: TData, index: number, parent?: Row<TData>) => string\n _queue: (cb: () => void) => void\n /**\n * Returns all columns in the table in their normalized and nested hierarchy.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getallcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getAllColumns: () => Column<TData, unknown>[]\n /**\n * Returns all columns in the table flattened to a single level.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getallflatcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getAllFlatColumns: () => Column<TData, unknown>[]\n /**\n * Returns all leaf-node columns in the table flattened to a single level. This does not include parent columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getallleafcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getAllLeafColumns: () => Column<TData, unknown>[]\n /**\n * Returns a single column by its ID.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getcolumn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getColumn: (columnId: string) => Column<TData, unknown> | undefined\n /**\n * Returns the core row model before any processing has been applied.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getcorerowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getCoreRowModel: () => RowModel<TData>\n /**\n * Returns the row with the given ID.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getrow)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getRow: (id: string, searchAll?: boolean) => Row<TData>\n /**\n * Returns the final model after all processing from other used features has been applied. This is the row model that is most commonly used for rendering.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getRowModel: () => RowModel<TData>\n /**\n * Call this function to get the table's current state. It's recommended to use this function and its state, especially when managing the table state manually. It is the exact same state used internally by the table for every feature and function it provides.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getstate)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getState: () => TableState\n /**\n * This is the resolved initial state of the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#initialstate)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n initialState: TableState\n /**\n * A read-only reference to the table's current options.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#options)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n options: RequiredKeys<TableOptionsResolved<TData>, 'state'>\n /**\n * Call this function to reset the table state to the initial state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#reset)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n reset: () => void\n /**\n * This function can be used to update the table options.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#setoptions)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n setOptions: (newOptions: Updater<TableOptionsResolved<TData>>) => void\n /**\n * Call this function to update the table state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#setstate)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n setState: (updater: Updater<TableState>) => void\n}\n\nexport function createTable<TData extends RowData>(\n options: TableOptionsResolved<TData>\n): Table<TData> {\n if (\n process.env.NODE_ENV !== 'production' &&\n (options.debugAll || options.debugTable)\n ) {\n console.info('Creating Table Instance...')\n }\n\n const _features = [...builtInFeatures, ...(options._features ?? [])]\n\n let table = { _features } as unknown as Table<TData>\n\n const defaultOptions = table._features.reduce((obj, feature) => {\n return Object.assign(obj, feature.getDefaultOptions?.(table))\n }, {}) as TableOptionsResolved<TData>\n\n const mergeOptions = (options: TableOptionsResolved<TData>) => {\n if (table.options.mergeOptions) {\n return table.options.mergeOptions(defaultOptions, options)\n }\n\n return {\n ...defaultOptions,\n ...options,\n }\n }\n\n const coreInitialState: CoreTableState = {}\n\n let initialState = {\n ...coreInitialState,\n ...(options.initialState ?? {}),\n } as TableState\n\n table._features.forEach(feature => {\n initialState = (feature.getInitialState?.(initialState) ??\n initialState) as TableState\n })\n\n const queued: (() => void)[] = []\n let queuedTimeout = false\n\n const coreInstance: CoreInstance<TData> = {\n _features,\n options: {\n ...defaultOptions,\n ...options,\n },\n initialState,\n _queue: cb => {\n queued.push(cb)\n\n if (!queuedTimeout) {\n queuedTimeout = true\n\n // Schedule a microtask to run the queued callbacks after\n // the current call stack (render, etc) has finished.\n Promise.resolve()\n .then(() => {\n while (queued.length) {\n queued.shift()!()\n }\n queuedTimeout = false\n })\n .catch(error =>\n setTimeout(() => {\n throw error\n })\n )\n }\n },\n reset: () => {\n table.setState(table.initialState)\n },\n setOptions: updater => {\n const newOptions = functionalUpdate(updater, table.options)\n table.options = mergeOptions(newOptions) as RequiredKeys<\n TableOptionsResolved<TData>,\n 'state'\n >\n },\n\n getState: () => {\n return table.options.state as TableState\n },\n\n setState: (updater: Updater<TableState>) => {\n table.options.onStateChange?.(updater)\n },\n\n _getRowId: (row: TData, index: number, parent?: Row<TData>) =>\n table.options.getRowId?.(row, index, parent) ??\n `${parent ? [parent.id, index].join('.') : index}`,\n\n getCoreRowModel: () => {\n if (!table._getCoreRowModel) {\n table._getCoreRowModel = table.options.getCoreRowModel(table)\n }\n\n return table._getCoreRowModel!()\n },\n\n // The final calls start at the bottom of the model,\n // expanded rows, which then work their way up\n\n getRowModel: () => {\n return table.getPaginationRowModel()\n },\n //in next version, we should just pass in the row model as the optional 2nd arg\n getRow: (id: string, searchAll?: boolean) => {\n let row = (\n searchAll ? table.getPrePaginationRowModel() : table.getRowModel()\n ).rowsById[id]\n\n if (!row) {\n row = table.getCoreRowModel().rowsById[id]\n if (!row) {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(`getRow could not find row with ID: ${id}`)\n }\n throw new Error()\n }\n }\n\n return row\n },\n _getDefaultColumnDef: memo(\n () => [table.options.defaultColumn],\n defaultColumn => {\n defaultColumn = (defaultColumn ?? {}) as Partial<\n ColumnDef<TData, unknown>\n >\n\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 // footer: props => props.header.column.id,\n cell: props => props.renderValue<any>()?.toString?.() ?? null,\n ...table._features.reduce((obj, feature) => {\n return Object.assign(obj, feature.getDefaultColumnDef?.())\n }, {}),\n ...defaultColumn,\n } as Partial<ColumnDef<TData, unknown>>\n },\n getMemoOptions(options, 'debugColumns', '_getDefaultColumnDef')\n ),\n\n _getColumnDefs: () => table.options.columns,\n\n getAllColumns: memo(\n () => [table._getColumnDefs()],\n columnDefs => {\n const recurseColumns = (\n columnDefs: ColumnDef<TData, unknown>[],\n parent?: Column<TData, unknown>,\n depth = 0\n ): Column<TData, unknown>[] => {\n return columnDefs.map(columnDef => {\n const column = createColumn(table, columnDef, depth, parent)\n\n const groupingColumnDef = columnDef as GroupColumnDef<\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(columnDefs)\n },\n getMemoOptions(options, 'debugColumns', 'getAllColumns')\n ),\n\n getAllFlatColumns: memo(\n () => [table.getAllColumns()],\n allColumns => {\n return allColumns.flatMap(column => {\n return column.getFlatColumns()\n })\n },\n getMemoOptions(options, 'debugColumns', 'getAllFlatColumns')\n ),\n\n _getAllFlatColumnsById: memo(\n () => [table.getAllFlatColumns()],\n flatColumns => {\n return flatColumns.reduce(\n (acc, column) => {\n acc[column.id] = column\n return acc\n },\n {} as Record<string, Column<TData, unknown>>\n )\n },\n getMemoOptions(options, 'debugColumns', 'getAllFlatColumnsById')\n ),\n\n getAllLeafColumns: memo(\n () => [table.getAllColumns(), table._getOrderColumnsFn()],\n (allColumns, orderColumns) => {\n let leafColumns = allColumns.flatMap(column => column.getLeafColumns())\n return orderColumns(leafColumns)\n },\n getMemoOptions(options, 'debugColumns', 'getAllLeafColumns')\n ),\n\n getColumn: columnId => {\n const column = table._getAllFlatColumnsById()[columnId]\n\n if (process.env.NODE_ENV !== 'production' && !column) {\n console.error(`[Table] Column with id '${columnId}' does not exist.`)\n }\n\n return column\n },\n }\n\n Object.assign(table, coreInstance)\n\n for (let index = 0; index < table._features.length; index++) {\n const feature = table._features[index]\n feature?.createTable?.(table)\n }\n\n return table\n}\n"],"names":["builtInFeatures","Headers","ColumnVisibility","ColumnOrdering","ColumnPinning","ColumnFaceting","ColumnFiltering","GlobalFaceting","GlobalFiltering","RowSorting","ColumnGrouping","RowExpanding","RowPagination","RowPinning","RowSelection","ColumnSizing","createTable","options","_options$_features","_options$initialState","process","env","NODE_ENV","debugAll","debugTable","console","info","_features","table","defaultOptions","reduce","obj","feature","Object","assign","getDefaultOptions","mergeOptions","coreInitialState","initialState","forEach","_feature$getInitialSt","getInitialState","queued","queuedTimeout","coreInstance","_queue","cb","push","Promise","resolve","then","length","shift","catch","error","setTimeout","reset","setState","setOptions","updater","newOptions","functionalUpdate","getState","state","onStateChange","_getRowId","row","index","parent","_table$options$getRow","getRowId","id","join","getCoreRowModel","_getCoreRowModel","getRowModel","getPaginationRowModel","getRow","searchAll","getPrePaginationRowModel","rowsById","Error","_getDefaultColumnDef","memo","defaultColumn","_defaultColumn","header","props","resolvedColumnDef","column","columnDef","accessorKey","accessorFn","cell","_props$renderValue$to","_props$renderValue","renderValue","toString","getDefaultColumnDef","getMemoOptions","_getColumnDefs","columns","getAllColumns","columnDefs","recurseColumns","depth","map","createColumn","groupingColumnDef","getAllFlatColumns","allColumns","flatMap","getFlatColumns","_getAllFlatColumnsById","flatColumns","acc","getAllLeafColumns","_getOrderColumnsFn","orderColumns","leafColumns","getLeafColumns","getColumn","columnId"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCA,MAAMA,eAAe,GAAG,CACtBC,eAAO,EACPC,iCAAgB,EAChBC,6BAAc,EACdC,2BAAa,EACbC,6BAAc,EACdC,+BAAe,EACfC,6BAAc;AAAE;AAChBC,+BAAe;AAAE;AACjBC,qBAAU,EACVC,6BAAc;AAAE;AAChBC,yBAAY,EACZC,2BAAa,EACbC,qBAAU,EACVC,yBAAY,EACZC,yBAAY,CACJ,CAAA;;AAEV;;AAgOO,SAASC,WAAWA,CACzBC,OAAoC,EACtB;EAAA,IAAAC,kBAAA,EAAAC,qBAAA,CAAA;AACd,EAAA,IACEC,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,KACpCL,OAAO,CAACM,QAAQ,IAAIN,OAAO,CAACO,UAAU,CAAC,EACxC;AACAC,IAAAA,OAAO,CAACC,IAAI,CAAC,4BAA4B,CAAC,CAAA;AAC5C,GAAA;AAEA,EAAA,MAAMC,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ACC,GAAG,CAACC,QAAQ,KAAK,YAAY,IAAI,CAACmE,MAAM,EAAE;AACpDhE,QAAAA,OAAO,CAAC6B,KAAK,CAAC,CAA2BoE,wBAAAA,EAAAA,QAAQ,mBAAmB,CAAC,CAAA;AACvE,OAAA;AAEA,MAAA,OAAOjC,MAAM,CAAA;AACf,KAAA;GACD,CAAA;AAEDxD,EAAAA,MAAM,CAACC,MAAM,CAACN,KAAK,EAAEgB,YAAY,CAAC,CAAA;AAElC,EAAA,KAAK,IAAIuB,KAAK,GAAG,CAAC,EAAEA,KAAK,GAAGvC,KAAK,CAACD,SAAS,CAACwB,MAAM,EAAEgB,KAAK,EAAE,EAAE;AAC3D,IAAA,MAAMnC,OAAO,GAAGJ,KAAK,CAACD,SAAS,CAACwC,KAAK,CAAC,CAAA;IACtCnC,OAAO,IAAA,IAAA,IAAPA,OAAO,CAAEhB,WAAW,IAAA,IAAA,IAApBgB,OAAO,CAAEhB,WAAW,CAAGY,KAAK,CAAC,CAAA;AAC/B,GAAA;AAEA,EAAA,OAAOA,KAAK,CAAA;AACd;;;;"}
@@ -57,7 +57,7 @@ export interface RowPinningRow {
57
57
  pin: (position: RowPinningPosition, includeLeafRows?: boolean, includeParentRows?: boolean) => void;
58
58
  }
59
59
  export interface RowPinningInstance<TData extends RowData> {
60
- _getPinnedRows: (position: 'top' | 'bottom') => Row<TData>[];
60
+ _getPinnedRows: (visiblePinnedRows: Array<Row<TData>>, pinnedRowIds: Array<string> | undefined, position: 'top' | 'bottom') => Row<TData>[];
61
61
  /**
62
62
  * Returns all bottom pinned rows.
63
63
  * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#getbottomrows)
@@ -89,13 +89,13 @@ const RowPinning = {
89
89
  return isTop ? 'top' : isBottom ? 'bottom' : false;
90
90
  };
91
91
  row.getPinnedIndex = () => {
92
- var _table$_getPinnedRows, _visiblePinnedRowIds$;
92
+ var _ref4, _visiblePinnedRowIds$;
93
93
  const position = row.getIsPinned();
94
94
  if (!position) return -1;
95
- const visiblePinnedRowIds = (_table$_getPinnedRows = table._getPinnedRows(position)) == null ? void 0 : _table$_getPinnedRows.map(_ref4 => {
95
+ const visiblePinnedRowIds = (_ref4 = position === 'top' ? table.getTopRows() : table.getBottomRows()) == null ? void 0 : _ref4.map(_ref5 => {
96
96
  let {
97
97
  id
98
- } = _ref4;
98
+ } = _ref5;
99
99
  return id;
100
100
  });
101
101
  return (_visiblePinnedRowIds$ = visiblePinnedRowIds == null ? void 0 : visiblePinnedRowIds.indexOf(row.id)) != null ? _visiblePinnedRowIds$ : -1;
@@ -116,7 +116,7 @@ const RowPinning = {
116
116
  }
117
117
  return Boolean((_pinningState$positio = pinningState[position]) == null ? void 0 : _pinningState$positio.length);
118
118
  };
119
- table._getPinnedRows = utils.memo(position => [table.getRowModel().rows, table.getState().rowPinning[position], position], (visibleRows, pinnedRowIds, position) => {
119
+ table._getPinnedRows = (visibleRows, pinnedRowIds, position) => {
120
120
  var _table$options$keepPi;
121
121
  const rows = ((_table$options$keepPi = table.options.keepPinnedRows) != null ? _table$options$keepPi : true) ?
122
122
  //get all rows that are pinned even if they would not be otherwise visible
@@ -131,9 +131,9 @@ const RowPinning = {
131
131
  ...d,
132
132
  position
133
133
  }));
134
- }, utils.getMemoOptions(table.options, 'debugRows', '_getPinnedRows'));
135
- table.getTopRows = () => table._getPinnedRows('top');
136
- table.getBottomRows = () => table._getPinnedRows('bottom');
134
+ };
135
+ table.getTopRows = utils.memo(() => [table.getRowModel().rows, table.getState().rowPinning.top], (allRows, topPinnedRowIds) => table._getPinnedRows(allRows, topPinnedRowIds, 'top'), utils.getMemoOptions(table.options, 'debugRows', 'getTopRows'));
136
+ table.getBottomRows = utils.memo(() => [table.getRowModel().rows, table.getState().rowPinning.bottom], (allRows, bottomPinnedRowIds) => table._getPinnedRows(allRows, bottomPinnedRowIds, 'bottom'), utils.getMemoOptions(table.options, 'debugRows', 'getBottomRows'));
137
137
  table.getCenterRows = utils.memo(() => [table.getRowModel().rows, table.getState().rowPinning.top, table.getState().rowPinning.bottom], (allRows, top, bottom) => {
138
138
  const topAndBottom = new Set([...(top != null ? top : []), ...(bottom != null ? bottom : [])]);
139
139
  return allRows.filter(d => !topAndBottom.has(d.id));
@@ -1 +1 @@
1
- {"version":3,"file":"RowPinning.js","sources":["../../../src/features/RowPinning.ts"],"sourcesContent":["import {\n OnChangeFn,\n Updater,\n Table,\n Row,\n RowData,\n TableFeature,\n} from '../types'\nimport { getMemoOptions, makeStateUpdater, memo } from '../utils'\n\nexport type RowPinningPosition = false | 'top' | 'bottom'\n\nexport interface RowPinningState {\n bottom?: string[]\n top?: string[]\n}\n\nexport interface RowPinningTableState {\n rowPinning: RowPinningState\n}\n\nexport interface RowPinningOptions<TData extends RowData> {\n /**\n * Enables/disables row pinning for the table. Defaults to `true`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#enablerowpinning)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n enableRowPinning?: boolean | ((row: Row<TData>) => boolean)\n /**\n * When `false`, pinned rows will not be visible if they are filtered or paginated out of the table. When `true`, pinned rows will always be visible regardless of filtering or pagination. Defaults to `true`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#keeppinnedrows)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n keepPinnedRows?: boolean\n /**\n * If provided, this function will be called with an `updaterFn` when `state.rowPinning` changes. This overrides the default internal state management, so you will also need to supply `state.rowPinning` from your own managed state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#onrowpinningchange)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/onrowpinningchange)\n */\n onRowPinningChange?: OnChangeFn<RowPinningState>\n}\n\nexport interface RowPinningDefaultOptions {\n onRowPinningChange: OnChangeFn<RowPinningState>\n}\n\nexport interface RowPinningRow {\n /**\n * Returns whether or not the row can be pinned.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#getcanpin-1)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n getCanPin: () => boolean\n /**\n * Returns the pinned position of the row. (`'top'`, `'bottom'` or `false`)\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#getispinned-1)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n getIsPinned: () => RowPinningPosition\n /**\n * Returns the numeric pinned index of the row within a pinned row group.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#getpinnedindex-1)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n getPinnedIndex: () => number\n /**\n * Pins a row to the `'top'` or `'bottom'`, or unpins the row to the center if `false` is passed.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#pin-1)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n pin: (\n position: RowPinningPosition,\n includeLeafRows?: boolean,\n includeParentRows?: boolean\n ) => void\n}\n\nexport interface RowPinningInstance<TData extends RowData> {\n _getPinnedRows: (position: 'top' | 'bottom') => Row<TData>[]\n /**\n * Returns all bottom pinned rows.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#getbottomrows)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n getBottomRows: () => Row<TData>[]\n /**\n * Returns all rows that are not pinned to the top or bottom.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#getcenterrows)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n getCenterRows: () => Row<TData>[]\n /**\n * Returns whether or not any rows are pinned. Optionally specify to only check for pinned rows in either the `top` or `bottom` position.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#getissomerowspinned)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n getIsSomeRowsPinned: (position?: RowPinningPosition) => boolean\n /**\n * Returns all top pinned rows.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#gettoprows)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n getTopRows: () => Row<TData>[]\n /**\n * Resets the **rowPinning** state to `initialState.rowPinning`, or `true` can be passed to force a default blank state reset to `{ top: [], bottom: [], }`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#resetrowpinning)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n resetRowPinning: (defaultState?: boolean) => void\n /**\n * Sets or updates the `state.rowPinning` state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#setrowpinning)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n setRowPinning: (updater: Updater<RowPinningState>) => void\n}\n\n//\n\nconst getDefaultRowPinningState = (): RowPinningState => ({\n top: [],\n bottom: [],\n})\n\nexport const RowPinning: TableFeature = {\n getInitialState: (state): RowPinningTableState => {\n return {\n rowPinning: getDefaultRowPinningState(),\n ...state,\n }\n },\n\n getDefaultOptions: <TData extends RowData>(\n table: Table<TData>\n ): RowPinningDefaultOptions => {\n return {\n onRowPinningChange: makeStateUpdater('rowPinning', table),\n }\n },\n\n createRow: <TData extends RowData>(\n row: Row<TData>,\n table: Table<TData>\n ): void => {\n row.pin = (position, includeLeafRows, includeParentRows) => {\n const leafRowIds = includeLeafRows\n ? row.getLeafRows().map(({ id }) => id)\n : []\n const parentRowIds = includeParentRows\n ? row.getParentRows().map(({ id }) => id)\n : []\n const rowIds = new Set([...parentRowIds, row.id, ...leafRowIds])\n\n table.setRowPinning(old => {\n if (position === 'bottom') {\n return {\n top: (old?.top ?? []).filter(d => !rowIds?.has(d)),\n bottom: [\n ...(old?.bottom ?? []).filter(d => !rowIds?.has(d)),\n ...Array.from(rowIds),\n ],\n }\n }\n\n if (position === 'top') {\n return {\n top: [\n ...(old?.top ?? []).filter(d => !rowIds?.has(d)),\n ...Array.from(rowIds),\n ],\n bottom: (old?.bottom ?? []).filter(d => !rowIds?.has(d)),\n }\n }\n\n return {\n top: (old?.top ?? []).filter(d => !rowIds?.has(d)),\n bottom: (old?.bottom ?? []).filter(d => !rowIds?.has(d)),\n }\n })\n }\n row.getCanPin = () => {\n const { enableRowPinning, enablePinning } = table.options\n if (typeof enableRowPinning === 'function') {\n return enableRowPinning(row)\n }\n return enableRowPinning ?? enablePinning ?? true\n }\n row.getIsPinned = () => {\n const rowIds = [row.id]\n\n const { top, bottom } = table.getState().rowPinning\n\n const isTop = rowIds.some(d => top?.includes(d))\n const isBottom = rowIds.some(d => bottom?.includes(d))\n\n return isTop ? 'top' : isBottom ? 'bottom' : false\n }\n row.getPinnedIndex = () => {\n const position = row.getIsPinned()\n if (!position) return -1\n\n const visiblePinnedRowIds = table\n ._getPinnedRows(position)\n ?.map(({ id }) => id)\n\n return visiblePinnedRowIds?.indexOf(row.id) ?? -1\n }\n },\n\n createTable: <TData extends RowData>(table: Table<TData>): void => {\n table.setRowPinning = updater => table.options.onRowPinningChange?.(updater)\n\n table.resetRowPinning = defaultState =>\n table.setRowPinning(\n defaultState\n ? getDefaultRowPinningState()\n : table.initialState?.rowPinning ?? getDefaultRowPinningState()\n )\n\n table.getIsSomeRowsPinned = position => {\n const pinningState = table.getState().rowPinning\n\n if (!position) {\n return Boolean(pinningState.top?.length || pinningState.bottom?.length)\n }\n return Boolean(pinningState[position]?.length)\n }\n\n table._getPinnedRows = memo(\n position => [\n table.getRowModel().rows,\n table.getState().rowPinning[position!],\n position,\n ],\n (visibleRows, pinnedRowIds, position) => {\n const rows =\n table.options.keepPinnedRows ?? true\n ? //get all rows that are pinned even if they would not be otherwise visible\n //account for expanded parent rows, but not pagination or filtering\n (pinnedRowIds ?? []).map(rowId => {\n const row = table.getRow(rowId, true)\n return row.getIsAllParentsExpanded() ? row : null\n })\n : //else get only visible rows that are pinned\n (pinnedRowIds ?? []).map(\n rowId => visibleRows.find(row => row.id === rowId)!\n )\n\n return rows\n .filter(Boolean)\n .map(d => ({ ...d, position })) as Row<TData>[]\n },\n getMemoOptions(table.options, 'debugRows', '_getPinnedRows')\n )\n\n table.getTopRows = () => table._getPinnedRows('top')\n\n table.getBottomRows = () => table._getPinnedRows('bottom')\n\n table.getCenterRows = memo(\n () => [\n table.getRowModel().rows,\n table.getState().rowPinning.top,\n table.getState().rowPinning.bottom,\n ],\n (allRows, top, bottom) => {\n const topAndBottom = new Set([...(top ?? []), ...(bottom ?? [])])\n return allRows.filter(d => !topAndBottom.has(d.id))\n },\n getMemoOptions(table.options, 'debugRows', 'getCenterRows')\n )\n },\n}\n"],"names":["getDefaultRowPinningState","top","bottom","RowPinning","getInitialState","state","rowPinning","getDefaultOptions","table","onRowPinningChange","makeStateUpdater","createRow","row","pin","position","includeLeafRows","includeParentRows","leafRowIds","getLeafRows","map","_ref","id","parentRowIds","getParentRows","_ref2","rowIds","Set","setRowPinning","old","_old$top3","_old$bottom3","_old$top","_old$bottom","filter","d","has","Array","from","_old$top2","_old$bottom2","getCanPin","_ref3","enableRowPinning","enablePinning","options","getIsPinned","getState","isTop","some","includes","isBottom","getPinnedIndex","_table$_getPinnedRows","_visiblePinnedRowIds$","visiblePinnedRowIds","_getPinnedRows","_ref4","indexOf","createTable","updater","resetRowPinning","defaultState","_table$initialState$r","_table$initialState","initialState","getIsSomeRowsPinned","_pinningState$positio","pinningState","_pinningState$top","_pinningState$bottom","Boolean","length","memo","getRowModel","rows","visibleRows","pinnedRowIds","_table$options$keepPi","keepPinnedRows","rowId","getRow","getIsAllParentsExpanded","find","getMemoOptions","getTopRows","getBottomRows","getCenterRows","allRows","topAndBottom"],"mappings":";;;;;;;;;;;;;;AAqHA;;AAEA,MAAMA,yBAAyB,GAAGA,OAAwB;AACxDC,EAAAA,GAAG,EAAE,EAAE;AACPC,EAAAA,MAAM,EAAE,EAAA;AACV,CAAC,CAAC,CAAA;AAEK,MAAMC,UAAwB,GAAG;EACtCC,eAAe,EAAGC,KAAK,IAA2B;IAChD,OAAO;MACL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,CAAC6E,aAAa,GAAG,MAAM7E,KAAK,CAAC+C,cAAc,CAAC,QAAQ,CAAC,CAAA;AAE1D/C,IAAAA,KAAK,CAAC8E,aAAa,GAAGd,UAAI,CACxB,MAAM,CACJhE,KAAK,CAACiE,WAAW,EAAE,CAACC,IAAI,EACxBlE,KAAK,CAACsC,QAAQ,EAAE,CAACxC,UAAU,CAACL,GAAG,EAC/BO,KAAK,CAACsC,QAAQ,EAAE,CAACxC,UAAU,CAACJ,MAAM,CACnC,EACD,CAACqF,OAAO,EAAEtF,GAAG,EAAEC,MAAM,KAAK;MACxB,MAAMsF,YAAY,GAAG,IAAI9D,GAAG,CAAC,CAAC,IAAIzB,GAAG,IAAA,IAAA,GAAHA,GAAG,GAAI,EAAE,GAAG,IAAIC,MAAM,IAAA,IAAA,GAANA,MAAM,GAAI,EAAE,EAAE,CAAC,CAAA;AACjE,MAAA,OAAOqF,OAAO,CAACtD,MAAM,CAACC,CAAC,IAAI,CAACsD,YAAY,CAACrD,GAAG,CAACD,CAAC,CAACb,EAAE,CAAC,CAAC,CAAA;KACpD,EACD8D,oBAAc,CAAC3E,KAAK,CAACoC,OAAO,EAAE,WAAW,EAAE,eAAe,CAC5D,CAAC,CAAA;AACH,GAAA;AACF;;;;"}
1
+ {"version":3,"file":"RowPinning.js","sources":["../../../src/features/RowPinning.ts"],"sourcesContent":["import {\n OnChangeFn,\n Updater,\n Table,\n Row,\n RowData,\n TableFeature,\n} from '../types'\nimport { getMemoOptions, makeStateUpdater, memo } from '../utils'\n\nexport type RowPinningPosition = false | 'top' | 'bottom'\n\nexport interface RowPinningState {\n bottom?: string[]\n top?: string[]\n}\n\nexport interface RowPinningTableState {\n rowPinning: RowPinningState\n}\n\nexport interface RowPinningOptions<TData extends RowData> {\n /**\n * Enables/disables row pinning for the table. Defaults to `true`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#enablerowpinning)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n enableRowPinning?: boolean | ((row: Row<TData>) => boolean)\n /**\n * When `false`, pinned rows will not be visible if they are filtered or paginated out of the table. When `true`, pinned rows will always be visible regardless of filtering or pagination. Defaults to `true`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#keeppinnedrows)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n keepPinnedRows?: boolean\n /**\n * If provided, this function will be called with an `updaterFn` when `state.rowPinning` changes. This overrides the default internal state management, so you will also need to supply `state.rowPinning` from your own managed state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#onrowpinningchange)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/onrowpinningchange)\n */\n onRowPinningChange?: OnChangeFn<RowPinningState>\n}\n\nexport interface RowPinningDefaultOptions {\n onRowPinningChange: OnChangeFn<RowPinningState>\n}\n\nexport interface RowPinningRow {\n /**\n * Returns whether or not the row can be pinned.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#getcanpin-1)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n getCanPin: () => boolean\n /**\n * Returns the pinned position of the row. (`'top'`, `'bottom'` or `false`)\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#getispinned-1)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n getIsPinned: () => RowPinningPosition\n /**\n * Returns the numeric pinned index of the row within a pinned row group.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#getpinnedindex-1)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n getPinnedIndex: () => number\n /**\n * Pins a row to the `'top'` or `'bottom'`, or unpins the row to the center if `false` is passed.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#pin-1)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n pin: (\n position: RowPinningPosition,\n includeLeafRows?: boolean,\n includeParentRows?: boolean\n ) => void\n}\n\nexport interface RowPinningInstance<TData extends RowData> {\n _getPinnedRows: (\n visiblePinnedRows: Array<Row<TData>>,\n pinnedRowIds: Array<string> | undefined,\n position: 'top' | 'bottom'\n ) => Row<TData>[]\n /**\n * Returns all bottom pinned rows.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#getbottomrows)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n getBottomRows: () => Row<TData>[]\n /**\n * Returns all rows that are not pinned to the top or bottom.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#getcenterrows)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n getCenterRows: () => Row<TData>[]\n /**\n * Returns whether or not any rows are pinned. Optionally specify to only check for pinned rows in either the `top` or `bottom` position.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#getissomerowspinned)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n getIsSomeRowsPinned: (position?: RowPinningPosition) => boolean\n /**\n * Returns all top pinned rows.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#gettoprows)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n getTopRows: () => Row<TData>[]\n /**\n * Resets the **rowPinning** state to `initialState.rowPinning`, or `true` can be passed to force a default blank state reset to `{ top: [], bottom: [], }`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#resetrowpinning)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n resetRowPinning: (defaultState?: boolean) => void\n /**\n * Sets or updates the `state.rowPinning` state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#setrowpinning)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n setRowPinning: (updater: Updater<RowPinningState>) => void\n}\n\n//\n\nconst getDefaultRowPinningState = (): RowPinningState => ({\n top: [],\n bottom: [],\n})\n\nexport const RowPinning: TableFeature = {\n getInitialState: (state): RowPinningTableState => {\n return {\n rowPinning: getDefaultRowPinningState(),\n ...state,\n }\n },\n\n getDefaultOptions: <TData extends RowData>(\n table: Table<TData>\n ): RowPinningDefaultOptions => {\n return {\n onRowPinningChange: makeStateUpdater('rowPinning', table),\n }\n },\n\n createRow: <TData extends RowData>(\n row: Row<TData>,\n table: Table<TData>\n ): void => {\n row.pin = (position, includeLeafRows, includeParentRows) => {\n const leafRowIds = includeLeafRows\n ? row.getLeafRows().map(({ id }) => id)\n : []\n const parentRowIds = includeParentRows\n ? row.getParentRows().map(({ id }) => id)\n : []\n const rowIds = new Set([...parentRowIds, row.id, ...leafRowIds])\n\n table.setRowPinning(old => {\n if (position === 'bottom') {\n return {\n top: (old?.top ?? []).filter(d => !rowIds?.has(d)),\n bottom: [\n ...(old?.bottom ?? []).filter(d => !rowIds?.has(d)),\n ...Array.from(rowIds),\n ],\n }\n }\n\n if (position === 'top') {\n return {\n top: [\n ...(old?.top ?? []).filter(d => !rowIds?.has(d)),\n ...Array.from(rowIds),\n ],\n bottom: (old?.bottom ?? []).filter(d => !rowIds?.has(d)),\n }\n }\n\n return {\n top: (old?.top ?? []).filter(d => !rowIds?.has(d)),\n bottom: (old?.bottom ?? []).filter(d => !rowIds?.has(d)),\n }\n })\n }\n row.getCanPin = () => {\n const { enableRowPinning, enablePinning } = table.options\n if (typeof enableRowPinning === 'function') {\n return enableRowPinning(row)\n }\n return enableRowPinning ?? enablePinning ?? true\n }\n row.getIsPinned = () => {\n const rowIds = [row.id]\n\n const { top, bottom } = table.getState().rowPinning\n\n const isTop = rowIds.some(d => top?.includes(d))\n const isBottom = rowIds.some(d => bottom?.includes(d))\n\n return isTop ? 'top' : isBottom ? 'bottom' : false\n }\n row.getPinnedIndex = () => {\n const position = row.getIsPinned()\n if (!position) return -1\n\n const visiblePinnedRowIds = (\n position === 'top' ? table.getTopRows() : table.getBottomRows()\n )?.map(({ id }) => id)\n\n return visiblePinnedRowIds?.indexOf(row.id) ?? -1\n }\n },\n\n createTable: <TData extends RowData>(table: Table<TData>): void => {\n table.setRowPinning = updater => table.options.onRowPinningChange?.(updater)\n\n table.resetRowPinning = defaultState =>\n table.setRowPinning(\n defaultState\n ? getDefaultRowPinningState()\n : table.initialState?.rowPinning ?? getDefaultRowPinningState()\n )\n\n table.getIsSomeRowsPinned = position => {\n const pinningState = table.getState().rowPinning\n\n if (!position) {\n return Boolean(pinningState.top?.length || pinningState.bottom?.length)\n }\n return Boolean(pinningState[position]?.length)\n }\n\n table._getPinnedRows = (visibleRows, pinnedRowIds, position) => {\n const rows =\n table.options.keepPinnedRows ?? true\n ? //get all rows that are pinned even if they would not be otherwise visible\n //account for expanded parent rows, but not pagination or filtering\n (pinnedRowIds ?? []).map(rowId => {\n const row = table.getRow(rowId, true)\n return row.getIsAllParentsExpanded() ? row : null\n })\n : //else get only visible rows that are pinned\n (pinnedRowIds ?? []).map(\n rowId => visibleRows.find(row => row.id === rowId)!\n )\n\n return rows.filter(Boolean).map(d => ({ ...d, position })) as Row<TData>[]\n }\n\n table.getTopRows = memo(\n () => [table.getRowModel().rows, table.getState().rowPinning.top],\n (allRows, topPinnedRowIds) =>\n table._getPinnedRows(allRows, topPinnedRowIds, 'top'),\n getMemoOptions(table.options, 'debugRows', 'getTopRows')\n )\n\n table.getBottomRows = memo(\n () => [table.getRowModel().rows, table.getState().rowPinning.bottom],\n (allRows, bottomPinnedRowIds) =>\n table._getPinnedRows(allRows, bottomPinnedRowIds, 'bottom'),\n getMemoOptions(table.options, 'debugRows', 'getBottomRows')\n )\n\n table.getCenterRows = memo(\n () => [\n table.getRowModel().rows,\n table.getState().rowPinning.top,\n table.getState().rowPinning.bottom,\n ],\n (allRows, top, bottom) => {\n const topAndBottom = new Set([...(top ?? []), ...(bottom ?? [])])\n return allRows.filter(d => !topAndBottom.has(d.id))\n },\n getMemoOptions(table.options, 'debugRows', 'getCenterRows')\n )\n },\n}\n"],"names":["getDefaultRowPinningState","top","bottom","RowPinning","getInitialState","state","rowPinning","getDefaultOptions","table","onRowPinningChange","makeStateUpdater","createRow","row","pin","position","includeLeafRows","includeParentRows","leafRowIds","getLeafRows","map","_ref","id","parentRowIds","getParentRows","_ref2","rowIds","Set","setRowPinning","old","_old$top3","_old$bottom3","_old$top","_old$bottom","filter","d","has","Array","from","_old$top2","_old$bottom2","getCanPin","_ref3","enableRowPinning","enablePinning","options","getIsPinned","getState","isTop","some","includes","isBottom","getPinnedIndex","_ref4","_visiblePinnedRowIds$","visiblePinnedRowIds","getTopRows","getBottomRows","_ref5","indexOf","createTable","updater","resetRowPinning","defaultState","_table$initialState$r","_table$initialState","initialState","getIsSomeRowsPinned","_pinningState$positio","pinningState","_pinningState$top","_pinningState$bottom","Boolean","length","_getPinnedRows","visibleRows","pinnedRowIds","_table$options$keepPi","rows","keepPinnedRows","rowId","getRow","getIsAllParentsExpanded","find","memo","getRowModel","allRows","topPinnedRowIds","getMemoOptions","bottomPinnedRowIds","getCenterRows","topAndBottom"],"mappings":";;;;;;;;;;;;;;AAyHA;;AAEA,MAAMA,yBAAyB,GAAGA,OAAwB;AACxDC,EAAAA,GAAG,EAAE,EAAE;AACPC,EAAAA,MAAM,EAAE,EAAA;AACV,CAAC,CAAC,CAAA;AAEK,MAAMC,UAAwB,GAAG;EACtCC,eAAe,EAAGC,KAAK,IAA2B;IAChD,OAAO;MACLC,UAAU,EAAEN,yBAAyB,EAAE;MACvC,GAAGK,KAAAA;KACJ,CAAA;GACF;EAEDE,iBAAiB,EACfC,KAAmB,IACU;IAC7B,OAAO;AACLC,MAAAA,kBAAkB,EAAEC,sBAAgB,CAAC,YAAY,EAAEF,KAAK,CAAA;KACzD,CAAA;GACF;AAEDG,EAAAA,SAAS,EAAEA,CACTC,GAAe,EACfJ,KAAmB,KACV;IACTI,GAAG,CAACC,GAAG,GAAG,CAACC,QAAQ,EAAEC,eAAe,EAAEC,iBAAiB,KAAK;AAC1D,MAAA,MAAMC,UAAU,GAAGF,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