@tanstack/table-core 9.0.0-beta.42 → 9.0.0-beta.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/rows/constructRow.cjs +1 -0
- package/dist/core/rows/constructRow.cjs.map +1 -1
- package/dist/core/rows/constructRow.js +1 -0
- package/dist/core/rows/constructRow.js.map +1 -1
- package/dist/core/rows/coreRowsFeature.cjs +9 -0
- package/dist/core/rows/coreRowsFeature.cjs.map +1 -1
- package/dist/core/rows/coreRowsFeature.js +10 -1
- package/dist/core/rows/coreRowsFeature.js.map +1 -1
- package/dist/core/rows/coreRowsFeature.types.d.cts +13 -0
- package/dist/core/rows/coreRowsFeature.types.d.ts +13 -0
- package/dist/core/rows/coreRowsFeature.utils.cjs +34 -0
- package/dist/core/rows/coreRowsFeature.utils.cjs.map +1 -1
- package/dist/core/rows/coreRowsFeature.utils.d.cts +15 -1
- package/dist/core/rows/coreRowsFeature.utils.d.ts +15 -1
- package/dist/core/rows/coreRowsFeature.utils.js +33 -1
- package/dist/core/rows/coreRowsFeature.utils.js.map +1 -1
- package/dist/static-functions.cjs +2 -0
- package/dist/static-functions.d.cts +2 -2
- package/dist/static-functions.d.ts +2 -2
- package/dist/static-functions.js +2 -2
- package/package.json +1 -1
- package/skills/api-not-found/SKILL.md +1 -1
- package/skills/client-vs-server/SKILL.md +1 -1
- package/skills/column-faceting/SKILL.md +1 -1
- package/skills/column-filtering/SKILL.md +1 -1
- package/skills/column-ordering/SKILL.md +1 -1
- package/skills/column-pinning/SKILL.md +1 -1
- package/skills/column-resizing/SKILL.md +1 -1
- package/skills/column-sizing/SKILL.md +1 -1
- package/skills/column-visibility/SKILL.md +1 -1
- package/skills/core/SKILL.md +1 -1
- package/skills/custom-features/SKILL.md +1 -1
- package/skills/expanding/SKILL.md +1 -1
- package/skills/global-filtering/SKILL.md +1 -1
- package/skills/grouping/SKILL.md +1 -1
- package/skills/migrate-v8-to-v9/SKILL.md +1 -1
- package/skills/pagination/SKILL.md +1 -1
- package/skills/row-pinning/SKILL.md +1 -1
- package/skills/row-selection/SKILL.md +1 -1
- package/skills/sorting/SKILL.md +1 -1
- package/skills/table-features/SKILL.md +1 -1
- package/skills/typescript/SKILL.md +1 -1
- package/src/core/rows/constructRow.ts +1 -0
- package/src/core/rows/coreRowsFeature.ts +15 -0
- package/src/core/rows/coreRowsFeature.types.ts +13 -0
- package/src/core/rows/coreRowsFeature.utils.ts +58 -0
|
@@ -21,6 +21,7 @@ function getRowPrototype(table) {
|
|
|
21
21
|
const constructRow = (table, id, original, rowIndex, depth, subRows, parentId) => {
|
|
22
22
|
const rowPrototype = getRowPrototype(table);
|
|
23
23
|
const row = Object.create(rowPrototype);
|
|
24
|
+
row._displayIndexCache = -1;
|
|
24
25
|
row._uniqueValuesCache = require_utils.makeObjectMap();
|
|
25
26
|
row._valuesCache = require_utils.makeObjectMap();
|
|
26
27
|
row.depth = depth;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constructRow.cjs","names":["makeObjectMap"],"sources":["../../../src/core/rows/constructRow.ts"],"sourcesContent":["import { makeObjectMap } from '../../utils'\nimport type { Table_Internal } from '../../types/Table'\nimport type { RowData } from '../../types/type-utils'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { Row } from '../../types/Row'\nimport type { Row_CoreProperties } from './coreRowsFeature.types'\n\n/**\n * Creates or retrieves the row prototype for a table.\n * The prototype is cached on the table and shared by all row instances.\n */\nfunction getRowPrototype<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): object {\n if (!table._rowPrototype) {\n table._rowPrototype = { table }\n const features = Object.values(table._features)\n for (let i = 0; i < features.length; i++) {\n features[i]!.assignRowPrototype?.(table._rowPrototype, table)\n }\n }\n return table._rowPrototype\n}\n\n/**\n * Constructs a row instance from normalized table internals.\n *\n * This wires core properties, feature prototype APIs, and instance data used by table rendering and row-model operations.\n */\nexport const constructRow = <\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n id: string,\n original: TData,\n rowIndex: number,\n depth: number,\n subRows?: Array<Row<TFeatures, TData>>,\n parentId?: string,\n): Row<TFeatures, TData> => {\n // Create row with shared prototype for memory efficiency\n const rowPrototype = getRowPrototype(table)\n const row = Object.create(rowPrototype) as Row_CoreProperties<\n TFeatures,\n TData\n >\n\n // Only assign instance-specific properties\n row._uniqueValuesCache = makeObjectMap()\n row._valuesCache = makeObjectMap()\n row.depth = depth\n row.id = id\n row.index = rowIndex\n row.original = original\n row.parentId = parentId\n row.subRows = subRows ?? []\n\n // Initialize instance-specific data (e.g., caches) for features that need it\n const features = Object.values(table._features)\n for (let i = 0; i < features.length; i++) {\n features[i]!.initRowInstanceData?.(row)\n }\n\n return row as Row<TFeatures, TData>\n}\n"],"mappings":";;;;;;;AAWA,SAAS,gBAGP,OAAiD;CACjD,IAAI,CAAC,MAAM,eAAe;EACxB,MAAM,gBAAgB,EAAE,MAAM;EAC9B,MAAM,WAAW,OAAO,OAAO,MAAM,SAAS;EAC9C,KAAK,IAAI,IAAI,GAAG,IAAI,SAAS,QAAQ,KACnC,SAAS,EAAE,CAAE,qBAAqB,MAAM,eAAe,KAAK;CAEhE;CACA,OAAO,MAAM;AACf;;;;;;AAOA,MAAa,gBAIX,OACA,IACA,UACA,UACA,OACA,SACA,aAC0B;CAE1B,MAAM,eAAe,gBAAgB,KAAK;CAC1C,MAAM,MAAM,OAAO,OAAO,YAAY;CAMtC,IAAI,qBAAqBA,4BAAc;CACvC,IAAI,eAAeA,4BAAc;CACjC,IAAI,QAAQ;CACZ,IAAI,KAAK;CACT,IAAI,QAAQ;CACZ,IAAI,WAAW;CACf,IAAI,WAAW;CACf,IAAI,UAAU,WAAW,CAAC;CAG1B,MAAM,WAAW,OAAO,OAAO,MAAM,SAAS;CAC9C,KAAK,IAAI,IAAI,GAAG,IAAI,SAAS,QAAQ,KACnC,SAAS,EAAE,CAAE,sBAAsB,GAAG;CAGxC,OAAO;AACT"}
|
|
1
|
+
{"version":3,"file":"constructRow.cjs","names":["makeObjectMap"],"sources":["../../../src/core/rows/constructRow.ts"],"sourcesContent":["import { makeObjectMap } from '../../utils'\nimport type { Table_Internal } from '../../types/Table'\nimport type { RowData } from '../../types/type-utils'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { Row } from '../../types/Row'\nimport type { Row_CoreProperties } from './coreRowsFeature.types'\n\n/**\n * Creates or retrieves the row prototype for a table.\n * The prototype is cached on the table and shared by all row instances.\n */\nfunction getRowPrototype<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): object {\n if (!table._rowPrototype) {\n table._rowPrototype = { table }\n const features = Object.values(table._features)\n for (let i = 0; i < features.length; i++) {\n features[i]!.assignRowPrototype?.(table._rowPrototype, table)\n }\n }\n return table._rowPrototype\n}\n\n/**\n * Constructs a row instance from normalized table internals.\n *\n * This wires core properties, feature prototype APIs, and instance data used by table rendering and row-model operations.\n */\nexport const constructRow = <\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n id: string,\n original: TData,\n rowIndex: number,\n depth: number,\n subRows?: Array<Row<TFeatures, TData>>,\n parentId?: string,\n): Row<TFeatures, TData> => {\n // Create row with shared prototype for memory efficiency\n const rowPrototype = getRowPrototype(table)\n const row = Object.create(rowPrototype) as Row_CoreProperties<\n TFeatures,\n TData\n >\n\n // Only assign instance-specific properties\n row._displayIndexCache = -1\n row._uniqueValuesCache = makeObjectMap()\n row._valuesCache = makeObjectMap()\n row.depth = depth\n row.id = id\n row.index = rowIndex\n row.original = original\n row.parentId = parentId\n row.subRows = subRows ?? []\n\n // Initialize instance-specific data (e.g., caches) for features that need it\n const features = Object.values(table._features)\n for (let i = 0; i < features.length; i++) {\n features[i]!.initRowInstanceData?.(row)\n }\n\n return row as Row<TFeatures, TData>\n}\n"],"mappings":";;;;;;;AAWA,SAAS,gBAGP,OAAiD;CACjD,IAAI,CAAC,MAAM,eAAe;EACxB,MAAM,gBAAgB,EAAE,MAAM;EAC9B,MAAM,WAAW,OAAO,OAAO,MAAM,SAAS;EAC9C,KAAK,IAAI,IAAI,GAAG,IAAI,SAAS,QAAQ,KACnC,SAAS,EAAE,CAAE,qBAAqB,MAAM,eAAe,KAAK;CAEhE;CACA,OAAO,MAAM;AACf;;;;;;AAOA,MAAa,gBAIX,OACA,IACA,UACA,UACA,OACA,SACA,aAC0B;CAE1B,MAAM,eAAe,gBAAgB,KAAK;CAC1C,MAAM,MAAM,OAAO,OAAO,YAAY;CAMtC,IAAI,qBAAqB;CACzB,IAAI,qBAAqBA,4BAAc;CACvC,IAAI,eAAeA,4BAAc;CACjC,IAAI,QAAQ;CACZ,IAAI,KAAK;CACT,IAAI,QAAQ;CACZ,IAAI,WAAW;CACf,IAAI,WAAW;CACf,IAAI,UAAU,WAAW,CAAC;CAG1B,MAAM,WAAW,OAAO,OAAO,MAAM,SAAS;CAC9C,KAAK,IAAI,IAAI,GAAG,IAAI,SAAS,QAAQ,KACnC,SAAS,EAAE,CAAE,sBAAsB,GAAG;CAGxC,OAAO;AACT"}
|
|
@@ -21,6 +21,7 @@ function getRowPrototype(table) {
|
|
|
21
21
|
const constructRow = (table, id, original, rowIndex, depth, subRows, parentId) => {
|
|
22
22
|
const rowPrototype = getRowPrototype(table);
|
|
23
23
|
const row = Object.create(rowPrototype);
|
|
24
|
+
row._displayIndexCache = -1;
|
|
24
25
|
row._uniqueValuesCache = makeObjectMap();
|
|
25
26
|
row._valuesCache = makeObjectMap();
|
|
26
27
|
row.depth = depth;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constructRow.js","names":[],"sources":["../../../src/core/rows/constructRow.ts"],"sourcesContent":["import { makeObjectMap } from '../../utils'\nimport type { Table_Internal } from '../../types/Table'\nimport type { RowData } from '../../types/type-utils'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { Row } from '../../types/Row'\nimport type { Row_CoreProperties } from './coreRowsFeature.types'\n\n/**\n * Creates or retrieves the row prototype for a table.\n * The prototype is cached on the table and shared by all row instances.\n */\nfunction getRowPrototype<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): object {\n if (!table._rowPrototype) {\n table._rowPrototype = { table }\n const features = Object.values(table._features)\n for (let i = 0; i < features.length; i++) {\n features[i]!.assignRowPrototype?.(table._rowPrototype, table)\n }\n }\n return table._rowPrototype\n}\n\n/**\n * Constructs a row instance from normalized table internals.\n *\n * This wires core properties, feature prototype APIs, and instance data used by table rendering and row-model operations.\n */\nexport const constructRow = <\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n id: string,\n original: TData,\n rowIndex: number,\n depth: number,\n subRows?: Array<Row<TFeatures, TData>>,\n parentId?: string,\n): Row<TFeatures, TData> => {\n // Create row with shared prototype for memory efficiency\n const rowPrototype = getRowPrototype(table)\n const row = Object.create(rowPrototype) as Row_CoreProperties<\n TFeatures,\n TData\n >\n\n // Only assign instance-specific properties\n row._uniqueValuesCache = makeObjectMap()\n row._valuesCache = makeObjectMap()\n row.depth = depth\n row.id = id\n row.index = rowIndex\n row.original = original\n row.parentId = parentId\n row.subRows = subRows ?? []\n\n // Initialize instance-specific data (e.g., caches) for features that need it\n const features = Object.values(table._features)\n for (let i = 0; i < features.length; i++) {\n features[i]!.initRowInstanceData?.(row)\n }\n\n return row as Row<TFeatures, TData>\n}\n"],"mappings":";;;;;;;AAWA,SAAS,gBAGP,OAAiD;CACjD,IAAI,CAAC,MAAM,eAAe;EACxB,MAAM,gBAAgB,EAAE,MAAM;EAC9B,MAAM,WAAW,OAAO,OAAO,MAAM,SAAS;EAC9C,KAAK,IAAI,IAAI,GAAG,IAAI,SAAS,QAAQ,KACnC,SAAS,EAAE,CAAE,qBAAqB,MAAM,eAAe,KAAK;CAEhE;CACA,OAAO,MAAM;AACf;;;;;;AAOA,MAAa,gBAIX,OACA,IACA,UACA,UACA,OACA,SACA,aAC0B;CAE1B,MAAM,eAAe,gBAAgB,KAAK;CAC1C,MAAM,MAAM,OAAO,OAAO,YAAY;CAMtC,IAAI,qBAAqB,cAAc;CACvC,IAAI,eAAe,cAAc;CACjC,IAAI,QAAQ;CACZ,IAAI,KAAK;CACT,IAAI,QAAQ;CACZ,IAAI,WAAW;CACf,IAAI,WAAW;CACf,IAAI,UAAU,WAAW,CAAC;CAG1B,MAAM,WAAW,OAAO,OAAO,MAAM,SAAS;CAC9C,KAAK,IAAI,IAAI,GAAG,IAAI,SAAS,QAAQ,KACnC,SAAS,EAAE,CAAE,sBAAsB,GAAG;CAGxC,OAAO;AACT"}
|
|
1
|
+
{"version":3,"file":"constructRow.js","names":[],"sources":["../../../src/core/rows/constructRow.ts"],"sourcesContent":["import { makeObjectMap } from '../../utils'\nimport type { Table_Internal } from '../../types/Table'\nimport type { RowData } from '../../types/type-utils'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { Row } from '../../types/Row'\nimport type { Row_CoreProperties } from './coreRowsFeature.types'\n\n/**\n * Creates or retrieves the row prototype for a table.\n * The prototype is cached on the table and shared by all row instances.\n */\nfunction getRowPrototype<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): object {\n if (!table._rowPrototype) {\n table._rowPrototype = { table }\n const features = Object.values(table._features)\n for (let i = 0; i < features.length; i++) {\n features[i]!.assignRowPrototype?.(table._rowPrototype, table)\n }\n }\n return table._rowPrototype\n}\n\n/**\n * Constructs a row instance from normalized table internals.\n *\n * This wires core properties, feature prototype APIs, and instance data used by table rendering and row-model operations.\n */\nexport const constructRow = <\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n id: string,\n original: TData,\n rowIndex: number,\n depth: number,\n subRows?: Array<Row<TFeatures, TData>>,\n parentId?: string,\n): Row<TFeatures, TData> => {\n // Create row with shared prototype for memory efficiency\n const rowPrototype = getRowPrototype(table)\n const row = Object.create(rowPrototype) as Row_CoreProperties<\n TFeatures,\n TData\n >\n\n // Only assign instance-specific properties\n row._displayIndexCache = -1\n row._uniqueValuesCache = makeObjectMap()\n row._valuesCache = makeObjectMap()\n row.depth = depth\n row.id = id\n row.index = rowIndex\n row.original = original\n row.parentId = parentId\n row.subRows = subRows ?? []\n\n // Initialize instance-specific data (e.g., caches) for features that need it\n const features = Object.values(table._features)\n for (let i = 0; i < features.length; i++) {\n features[i]!.initRowInstanceData?.(row)\n }\n\n return row as Row<TFeatures, TData>\n}\n"],"mappings":";;;;;;;AAWA,SAAS,gBAGP,OAAiD;CACjD,IAAI,CAAC,MAAM,eAAe;EACxB,MAAM,gBAAgB,EAAE,MAAM;EAC9B,MAAM,WAAW,OAAO,OAAO,MAAM,SAAS;EAC9C,KAAK,IAAI,IAAI,GAAG,IAAI,SAAS,QAAQ,KACnC,SAAS,EAAE,CAAE,qBAAqB,MAAM,eAAe,KAAK;CAEhE;CACA,OAAO,MAAM;AACf;;;;;;AAOA,MAAa,gBAIX,OACA,IACA,UACA,UACA,OACA,SACA,aAC0B;CAE1B,MAAM,eAAe,gBAAgB,KAAK;CAC1C,MAAM,MAAM,OAAO,OAAO,YAAY;CAMtC,IAAI,qBAAqB;CACzB,IAAI,qBAAqB,cAAc;CACvC,IAAI,eAAe,cAAc;CACjC,IAAI,QAAQ;CACZ,IAAI,KAAK;CACT,IAAI,QAAQ;CACZ,IAAI,WAAW;CACf,IAAI,WAAW;CACf,IAAI,UAAU,WAAW,CAAC;CAG1B,MAAM,WAAW,OAAO,OAAO,MAAM,SAAS;CAC9C,KAAK,IAAI,IAAI,GAAG,IAAI,SAAS,QAAQ,KACnC,SAAS,EAAE,CAAE,sBAAsB,GAAG;CAGxC,OAAO;AACT"}
|
|
@@ -8,6 +8,7 @@ const require_coreRowsFeature_utils = require('./coreRowsFeature.utils.cjs');
|
|
|
8
8
|
const coreRowsFeature = {
|
|
9
9
|
assignRowPrototype: (prototype, table) => {
|
|
10
10
|
require_utils.assignPrototypeAPIs("coreRowsFeature", prototype, table, {
|
|
11
|
+
row_getDisplayIndex: { fn: (row) => require_coreRowsFeature_utils.row_getDisplayIndex(row) },
|
|
11
12
|
row_getAllCellsByColumnId: {
|
|
12
13
|
fn: (row) => require_coreRowsFeature_utils.row_getAllCellsByColumnId(row),
|
|
13
14
|
memoDeps: (row) => [row.getAllCells()]
|
|
@@ -29,6 +30,14 @@ const coreRowsFeature = {
|
|
|
29
30
|
},
|
|
30
31
|
constructTableAPIs: (table) => {
|
|
31
32
|
require_utils.assignTableAPIs("coreRowsFeature", table, {
|
|
33
|
+
table_getRowsInDisplayOrder: {
|
|
34
|
+
fn: () => require_coreRowsFeature_utils.table_getRowsInDisplayOrder(table),
|
|
35
|
+
memoDeps: () => [
|
|
36
|
+
table.getPrePaginatedRowModel().rows,
|
|
37
|
+
table.options.paginateExpandedRows,
|
|
38
|
+
table.options.paginateExpandedRows === false ? table.atoms.expanded?.get() : void 0
|
|
39
|
+
]
|
|
40
|
+
},
|
|
32
41
|
table_getRowId: { fn: (originalRow, index, parent) => require_coreRowsFeature_utils.table_getRowId(originalRow, table, index, parent) },
|
|
33
42
|
table_getRow: { fn: (id, searchAll) => require_coreRowsFeature_utils.table_getRow(table, id, searchAll) }
|
|
34
43
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coreRowsFeature.cjs","names":["row_getAllCellsByColumnId","row_getAllCells","row_getLeafRows","row_getParentRow","row_getParentRows","row_getUniqueValues","row_getValue","row_renderValue","table_getRowId","table_getRow"],"sources":["../../../src/core/rows/coreRowsFeature.ts"],"sourcesContent":["import { assignPrototypeAPIs, assignTableAPIs } from '../../utils'\nimport {\n row_getAllCells,\n row_getAllCellsByColumnId,\n row_getLeafRows,\n row_getParentRow,\n row_getParentRows,\n row_getUniqueValues,\n row_getValue,\n row_renderValue,\n table_getRow,\n table_getRowId,\n} from './coreRowsFeature.utils'\nimport type { TableFeature } from '../../types/TableFeatures'\n\n/**\n * Core feature that creates row APIs for values, cells, and tree traversal.\n */\nexport const coreRowsFeature: TableFeature = {\n assignRowPrototype: (prototype, table) => {\n assignPrototypeAPIs('coreRowsFeature', prototype, table, {\n row_getAllCellsByColumnId: {\n fn: (row) => row_getAllCellsByColumnId(row),\n memoDeps: (row) => [row.getAllCells()],\n },\n row_getAllCells: {\n fn: (row) => row_getAllCells(row),\n memoDeps: (row) => [row.table.getAllLeafColumns()],\n },\n row_getLeafRows: {\n fn: (row) => row_getLeafRows(row),\n memoDeps: (row) => [row.subRows],\n },\n row_getParentRow: {\n fn: (row) => row_getParentRow(row),\n },\n row_getParentRows: {\n fn: (row) => row_getParentRows(row),\n },\n row_getUniqueValues: {\n fn: (row, columnId) => row_getUniqueValues(row, columnId),\n },\n row_getValue: {\n fn: (row, columnId) => row_getValue(row, columnId),\n },\n row_renderValue: {\n fn: (row, columnId) => row_renderValue(row, columnId),\n },\n })\n },\n constructTableAPIs: (table) => {\n assignTableAPIs('coreRowsFeature', table, {\n table_getRowId: {\n fn: (originalRow, index, parent) =>\n table_getRowId(originalRow, table, index, parent),\n },\n table_getRow: {\n fn: (id: string, searchAll?: boolean) =>\n table_getRow(table, id, searchAll),\n },\n })\n },\n}\n"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"coreRowsFeature.cjs","names":["row_getDisplayIndex","row_getAllCellsByColumnId","row_getAllCells","row_getLeafRows","row_getParentRow","row_getParentRows","row_getUniqueValues","row_getValue","row_renderValue","table_getRowsInDisplayOrder","table_getRowId","table_getRow"],"sources":["../../../src/core/rows/coreRowsFeature.ts"],"sourcesContent":["import { assignPrototypeAPIs, assignTableAPIs } from '../../utils'\nimport {\n row_getAllCells,\n row_getAllCellsByColumnId,\n row_getDisplayIndex,\n row_getLeafRows,\n row_getParentRow,\n row_getParentRows,\n row_getUniqueValues,\n row_getValue,\n row_renderValue,\n table_getRow,\n table_getRowId,\n table_getRowsInDisplayOrder,\n} from './coreRowsFeature.utils'\nimport type { TableFeature } from '../../types/TableFeatures'\n\n/**\n * Core feature that creates row APIs for values, cells, and tree traversal.\n */\nexport const coreRowsFeature: TableFeature = {\n assignRowPrototype: (prototype, table) => {\n assignPrototypeAPIs('coreRowsFeature', prototype, table, {\n row_getDisplayIndex: {\n fn: (row) => row_getDisplayIndex(row),\n },\n row_getAllCellsByColumnId: {\n fn: (row) => row_getAllCellsByColumnId(row),\n memoDeps: (row) => [row.getAllCells()],\n },\n row_getAllCells: {\n fn: (row) => row_getAllCells(row),\n memoDeps: (row) => [row.table.getAllLeafColumns()],\n },\n row_getLeafRows: {\n fn: (row) => row_getLeafRows(row),\n memoDeps: (row) => [row.subRows],\n },\n row_getParentRow: {\n fn: (row) => row_getParentRow(row),\n },\n row_getParentRows: {\n fn: (row) => row_getParentRows(row),\n },\n row_getUniqueValues: {\n fn: (row, columnId) => row_getUniqueValues(row, columnId),\n },\n row_getValue: {\n fn: (row, columnId) => row_getValue(row, columnId),\n },\n row_renderValue: {\n fn: (row, columnId) => row_renderValue(row, columnId),\n },\n })\n },\n constructTableAPIs: (table) => {\n assignTableAPIs('coreRowsFeature', table, {\n table_getRowsInDisplayOrder: {\n fn: () => table_getRowsInDisplayOrder(table),\n memoDeps: () => [\n table.getPrePaginatedRowModel().rows,\n table.options.paginateExpandedRows,\n table.options.paginateExpandedRows === false\n ? table.atoms.expanded?.get()\n : undefined,\n ],\n },\n table_getRowId: {\n fn: (originalRow, index, parent) =>\n table_getRowId(originalRow, table, index, parent),\n },\n table_getRow: {\n fn: (id: string, searchAll?: boolean) =>\n table_getRow(table, id, searchAll),\n },\n })\n },\n}\n"],"mappings":";;;;;;;AAoBA,MAAa,kBAAgC;CAC3C,qBAAqB,WAAW,UAAU;EACxC,kCAAoB,mBAAmB,WAAW,OAAO;GACvD,qBAAqB,EACnB,KAAK,QAAQA,kDAAoB,GAAG,EACtC;GACA,2BAA2B;IACzB,KAAK,QAAQC,wDAA0B,GAAG;IAC1C,WAAW,QAAQ,CAAC,IAAI,YAAY,CAAC;GACvC;GACA,iBAAiB;IACf,KAAK,QAAQC,8CAAgB,GAAG;IAChC,WAAW,QAAQ,CAAC,IAAI,MAAM,kBAAkB,CAAC;GACnD;GACA,iBAAiB;IACf,KAAK,QAAQC,8CAAgB,GAAG;IAChC,WAAW,QAAQ,CAAC,IAAI,OAAO;GACjC;GACA,kBAAkB,EAChB,KAAK,QAAQC,+CAAiB,GAAG,EACnC;GACA,mBAAmB,EACjB,KAAK,QAAQC,gDAAkB,GAAG,EACpC;GACA,qBAAqB,EACnB,KAAK,KAAK,aAAaC,kDAAoB,KAAK,QAAQ,EAC1D;GACA,cAAc,EACZ,KAAK,KAAK,aAAaC,2CAAa,KAAK,QAAQ,EACnD;GACA,iBAAiB,EACf,KAAK,KAAK,aAAaC,8CAAgB,KAAK,QAAQ,EACtD;EACF,CAAC;CACH;CACA,qBAAqB,UAAU;EAC7B,8BAAgB,mBAAmB,OAAO;GACxC,6BAA6B;IAC3B,UAAUC,0DAA4B,KAAK;IAC3C,gBAAgB;KACd,MAAM,wBAAwB,CAAC,CAAC;KAChC,MAAM,QAAQ;KACd,MAAM,QAAQ,yBAAyB,QACnC,MAAM,MAAM,UAAU,IAAI,IAC1B;IACN;GACF;GACA,gBAAgB,EACd,KAAK,aAAa,OAAO,WACvBC,6CAAe,aAAa,OAAO,OAAO,MAAM,EACpD;GACA,cAAc,EACZ,KAAK,IAAY,cACfC,2CAAa,OAAO,IAAI,SAAS,EACrC;EACF,CAAC;CACH;AACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { assignPrototypeAPIs, assignTableAPIs } from "../../utils.js";
|
|
2
|
-
import { row_getAllCells, row_getAllCellsByColumnId, row_getLeafRows, row_getParentRow, row_getParentRows, row_getUniqueValues, row_getValue, row_renderValue, table_getRow, table_getRowId } from "./coreRowsFeature.utils.js";
|
|
2
|
+
import { row_getAllCells, row_getAllCellsByColumnId, row_getDisplayIndex, row_getLeafRows, row_getParentRow, row_getParentRows, row_getUniqueValues, row_getValue, row_renderValue, table_getRow, table_getRowId, table_getRowsInDisplayOrder } from "./coreRowsFeature.utils.js";
|
|
3
3
|
|
|
4
4
|
//#region src/core/rows/coreRowsFeature.ts
|
|
5
5
|
/**
|
|
@@ -8,6 +8,7 @@ import { row_getAllCells, row_getAllCellsByColumnId, row_getLeafRows, row_getPar
|
|
|
8
8
|
const coreRowsFeature = {
|
|
9
9
|
assignRowPrototype: (prototype, table) => {
|
|
10
10
|
assignPrototypeAPIs("coreRowsFeature", prototype, table, {
|
|
11
|
+
row_getDisplayIndex: { fn: (row) => row_getDisplayIndex(row) },
|
|
11
12
|
row_getAllCellsByColumnId: {
|
|
12
13
|
fn: (row) => row_getAllCellsByColumnId(row),
|
|
13
14
|
memoDeps: (row) => [row.getAllCells()]
|
|
@@ -29,6 +30,14 @@ const coreRowsFeature = {
|
|
|
29
30
|
},
|
|
30
31
|
constructTableAPIs: (table) => {
|
|
31
32
|
assignTableAPIs("coreRowsFeature", table, {
|
|
33
|
+
table_getRowsInDisplayOrder: {
|
|
34
|
+
fn: () => table_getRowsInDisplayOrder(table),
|
|
35
|
+
memoDeps: () => [
|
|
36
|
+
table.getPrePaginatedRowModel().rows,
|
|
37
|
+
table.options.paginateExpandedRows,
|
|
38
|
+
table.options.paginateExpandedRows === false ? table.atoms.expanded?.get() : void 0
|
|
39
|
+
]
|
|
40
|
+
},
|
|
32
41
|
table_getRowId: { fn: (originalRow, index, parent) => table_getRowId(originalRow, table, index, parent) },
|
|
33
42
|
table_getRow: { fn: (id, searchAll) => table_getRow(table, id, searchAll) }
|
|
34
43
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coreRowsFeature.js","names":[],"sources":["../../../src/core/rows/coreRowsFeature.ts"],"sourcesContent":["import { assignPrototypeAPIs, assignTableAPIs } from '../../utils'\nimport {\n row_getAllCells,\n row_getAllCellsByColumnId,\n row_getLeafRows,\n row_getParentRow,\n row_getParentRows,\n row_getUniqueValues,\n row_getValue,\n row_renderValue,\n table_getRow,\n table_getRowId,\n} from './coreRowsFeature.utils'\nimport type { TableFeature } from '../../types/TableFeatures'\n\n/**\n * Core feature that creates row APIs for values, cells, and tree traversal.\n */\nexport const coreRowsFeature: TableFeature = {\n assignRowPrototype: (prototype, table) => {\n assignPrototypeAPIs('coreRowsFeature', prototype, table, {\n row_getAllCellsByColumnId: {\n fn: (row) => row_getAllCellsByColumnId(row),\n memoDeps: (row) => [row.getAllCells()],\n },\n row_getAllCells: {\n fn: (row) => row_getAllCells(row),\n memoDeps: (row) => [row.table.getAllLeafColumns()],\n },\n row_getLeafRows: {\n fn: (row) => row_getLeafRows(row),\n memoDeps: (row) => [row.subRows],\n },\n row_getParentRow: {\n fn: (row) => row_getParentRow(row),\n },\n row_getParentRows: {\n fn: (row) => row_getParentRows(row),\n },\n row_getUniqueValues: {\n fn: (row, columnId) => row_getUniqueValues(row, columnId),\n },\n row_getValue: {\n fn: (row, columnId) => row_getValue(row, columnId),\n },\n row_renderValue: {\n fn: (row, columnId) => row_renderValue(row, columnId),\n },\n })\n },\n constructTableAPIs: (table) => {\n assignTableAPIs('coreRowsFeature', table, {\n table_getRowId: {\n fn: (originalRow, index, parent) =>\n table_getRowId(originalRow, table, index, parent),\n },\n table_getRow: {\n fn: (id: string, searchAll?: boolean) =>\n table_getRow(table, id, searchAll),\n },\n })\n },\n}\n"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"coreRowsFeature.js","names":[],"sources":["../../../src/core/rows/coreRowsFeature.ts"],"sourcesContent":["import { assignPrototypeAPIs, assignTableAPIs } from '../../utils'\nimport {\n row_getAllCells,\n row_getAllCellsByColumnId,\n row_getDisplayIndex,\n row_getLeafRows,\n row_getParentRow,\n row_getParentRows,\n row_getUniqueValues,\n row_getValue,\n row_renderValue,\n table_getRow,\n table_getRowId,\n table_getRowsInDisplayOrder,\n} from './coreRowsFeature.utils'\nimport type { TableFeature } from '../../types/TableFeatures'\n\n/**\n * Core feature that creates row APIs for values, cells, and tree traversal.\n */\nexport const coreRowsFeature: TableFeature = {\n assignRowPrototype: (prototype, table) => {\n assignPrototypeAPIs('coreRowsFeature', prototype, table, {\n row_getDisplayIndex: {\n fn: (row) => row_getDisplayIndex(row),\n },\n row_getAllCellsByColumnId: {\n fn: (row) => row_getAllCellsByColumnId(row),\n memoDeps: (row) => [row.getAllCells()],\n },\n row_getAllCells: {\n fn: (row) => row_getAllCells(row),\n memoDeps: (row) => [row.table.getAllLeafColumns()],\n },\n row_getLeafRows: {\n fn: (row) => row_getLeafRows(row),\n memoDeps: (row) => [row.subRows],\n },\n row_getParentRow: {\n fn: (row) => row_getParentRow(row),\n },\n row_getParentRows: {\n fn: (row) => row_getParentRows(row),\n },\n row_getUniqueValues: {\n fn: (row, columnId) => row_getUniqueValues(row, columnId),\n },\n row_getValue: {\n fn: (row, columnId) => row_getValue(row, columnId),\n },\n row_renderValue: {\n fn: (row, columnId) => row_renderValue(row, columnId),\n },\n })\n },\n constructTableAPIs: (table) => {\n assignTableAPIs('coreRowsFeature', table, {\n table_getRowsInDisplayOrder: {\n fn: () => table_getRowsInDisplayOrder(table),\n memoDeps: () => [\n table.getPrePaginatedRowModel().rows,\n table.options.paginateExpandedRows,\n table.options.paginateExpandedRows === false\n ? table.atoms.expanded?.get()\n : undefined,\n ],\n },\n table_getRowId: {\n fn: (originalRow, index, parent) =>\n table_getRowId(originalRow, table, index, parent),\n },\n table_getRow: {\n fn: (id: string, searchAll?: boolean) =>\n table_getRow(table, id, searchAll),\n },\n })\n },\n}\n"],"mappings":";;;;;;;AAoBA,MAAa,kBAAgC;CAC3C,qBAAqB,WAAW,UAAU;EACxC,oBAAoB,mBAAmB,WAAW,OAAO;GACvD,qBAAqB,EACnB,KAAK,QAAQ,oBAAoB,GAAG,EACtC;GACA,2BAA2B;IACzB,KAAK,QAAQ,0BAA0B,GAAG;IAC1C,WAAW,QAAQ,CAAC,IAAI,YAAY,CAAC;GACvC;GACA,iBAAiB;IACf,KAAK,QAAQ,gBAAgB,GAAG;IAChC,WAAW,QAAQ,CAAC,IAAI,MAAM,kBAAkB,CAAC;GACnD;GACA,iBAAiB;IACf,KAAK,QAAQ,gBAAgB,GAAG;IAChC,WAAW,QAAQ,CAAC,IAAI,OAAO;GACjC;GACA,kBAAkB,EAChB,KAAK,QAAQ,iBAAiB,GAAG,EACnC;GACA,mBAAmB,EACjB,KAAK,QAAQ,kBAAkB,GAAG,EACpC;GACA,qBAAqB,EACnB,KAAK,KAAK,aAAa,oBAAoB,KAAK,QAAQ,EAC1D;GACA,cAAc,EACZ,KAAK,KAAK,aAAa,aAAa,KAAK,QAAQ,EACnD;GACA,iBAAiB,EACf,KAAK,KAAK,aAAa,gBAAgB,KAAK,QAAQ,EACtD;EACF,CAAC;CACH;CACA,qBAAqB,UAAU;EAC7B,gBAAgB,mBAAmB,OAAO;GACxC,6BAA6B;IAC3B,UAAU,4BAA4B,KAAK;IAC3C,gBAAgB;KACd,MAAM,wBAAwB,CAAC,CAAC;KAChC,MAAM,QAAQ;KACd,MAAM,QAAQ,yBAAyB,QACnC,MAAM,MAAM,UAAU,IAAI,IAC1B;IACN;GACF;GACA,gBAAgB,EACd,KAAK,aAAa,OAAO,WACvB,eAAe,aAAa,OAAO,OAAO,MAAM,EACpD;GACA,cAAc,EACZ,KAAK,IAAY,cACf,aAAa,OAAO,IAAI,SAAS,EACrC;EACF,CAAC;CACH;AACF"}
|
|
@@ -8,6 +8,7 @@ import { TableFeatures } from "../../types/TableFeatures.cjs";
|
|
|
8
8
|
//#region src/core/rows/coreRowsFeature.types.d.ts
|
|
9
9
|
interface Row_CoreProperties<in out TFeatures extends TableFeatures, in out TData extends RowData> {
|
|
10
10
|
_cellsCache?: WeakMap<Column<TFeatures, TData, unknown>, Cell<TFeatures, TData, unknown>>;
|
|
11
|
+
_displayIndexCache: number;
|
|
11
12
|
_uniqueValuesCache: Record<string, unknown>;
|
|
12
13
|
_valuesCache: Record<string, unknown>;
|
|
13
14
|
/**
|
|
@@ -44,6 +45,11 @@ interface Row_CoreProperties<in out TFeatures extends TableFeatures, in out TDat
|
|
|
44
45
|
table: Table<TFeatures, TData>;
|
|
45
46
|
}
|
|
46
47
|
interface Row_Row<in out TFeatures extends TableFeatures, in out TData extends RowData> extends Row_CoreProperties<TFeatures, TData> {
|
|
48
|
+
/**
|
|
49
|
+
* Returns the zero-based index of the row in the current display order
|
|
50
|
+
* before pagination, or `-1` if the row is not in that model.
|
|
51
|
+
*/
|
|
52
|
+
getDisplayIndex: () => number;
|
|
47
53
|
/**
|
|
48
54
|
* Builds a lookup of this row's cells keyed by leaf column id.
|
|
49
55
|
*/
|
|
@@ -90,6 +96,13 @@ interface TableOptions_Rows<in out TFeatures extends TableFeatures, in out TData
|
|
|
90
96
|
getSubRows?: (originalRow: TData, index: number) => undefined | ReadonlyArray<TData>;
|
|
91
97
|
}
|
|
92
98
|
interface Table_Rows<in out TFeatures extends TableFeatures, in out TData extends RowData> {
|
|
99
|
+
/**
|
|
100
|
+
* Returns the rows in the current display order and assigns their display
|
|
101
|
+
* indexes. When expanded rows bypass pagination, expanded descendants are
|
|
102
|
+
* included in this order. This is the memoized source for
|
|
103
|
+
* `row.getDisplayIndex()`.
|
|
104
|
+
*/
|
|
105
|
+
getRowsInDisplayOrder: () => Array<Row<TFeatures, TData>>;
|
|
93
106
|
getRowId: (_: TData, index: number, parent?: Row<TFeatures, TData>) => string;
|
|
94
107
|
/**
|
|
95
108
|
* Returns the row with the given ID.
|
|
@@ -8,6 +8,7 @@ import { TableFeatures } from "../../types/TableFeatures.js";
|
|
|
8
8
|
//#region src/core/rows/coreRowsFeature.types.d.ts
|
|
9
9
|
interface Row_CoreProperties<in out TFeatures extends TableFeatures, in out TData extends RowData> {
|
|
10
10
|
_cellsCache?: WeakMap<Column<TFeatures, TData, unknown>, Cell<TFeatures, TData, unknown>>;
|
|
11
|
+
_displayIndexCache: number;
|
|
11
12
|
_uniqueValuesCache: Record<string, unknown>;
|
|
12
13
|
_valuesCache: Record<string, unknown>;
|
|
13
14
|
/**
|
|
@@ -44,6 +45,11 @@ interface Row_CoreProperties<in out TFeatures extends TableFeatures, in out TDat
|
|
|
44
45
|
table: Table<TFeatures, TData>;
|
|
45
46
|
}
|
|
46
47
|
interface Row_Row<in out TFeatures extends TableFeatures, in out TData extends RowData> extends Row_CoreProperties<TFeatures, TData> {
|
|
48
|
+
/**
|
|
49
|
+
* Returns the zero-based index of the row in the current display order
|
|
50
|
+
* before pagination, or `-1` if the row is not in that model.
|
|
51
|
+
*/
|
|
52
|
+
getDisplayIndex: () => number;
|
|
47
53
|
/**
|
|
48
54
|
* Builds a lookup of this row's cells keyed by leaf column id.
|
|
49
55
|
*/
|
|
@@ -90,6 +96,13 @@ interface TableOptions_Rows<in out TFeatures extends TableFeatures, in out TData
|
|
|
90
96
|
getSubRows?: (originalRow: TData, index: number) => undefined | ReadonlyArray<TData>;
|
|
91
97
|
}
|
|
92
98
|
interface Table_Rows<in out TFeatures extends TableFeatures, in out TData extends RowData> {
|
|
99
|
+
/**
|
|
100
|
+
* Returns the rows in the current display order and assigns their display
|
|
101
|
+
* indexes. When expanded rows bypass pagination, expanded descendants are
|
|
102
|
+
* included in this order. This is the memoized source for
|
|
103
|
+
* `row.getDisplayIndex()`.
|
|
104
|
+
*/
|
|
105
|
+
getRowsInDisplayOrder: () => Array<Row<TFeatures, TData>>;
|
|
93
106
|
getRowId: (_: TData, index: number, parent?: Row<TFeatures, TData>) => string;
|
|
94
107
|
/**
|
|
95
108
|
* Returns the row with the given ID.
|
|
@@ -3,6 +3,38 @@ const require_constructCell = require('../cells/constructCell.cjs');
|
|
|
3
3
|
|
|
4
4
|
//#region src/core/rows/coreRowsFeature.utils.ts
|
|
5
5
|
/**
|
|
6
|
+
* Returns this row's zero-based position in the current pre-pagination row
|
|
7
|
+
* model. Rows outside that model return `-1`.
|
|
8
|
+
*/
|
|
9
|
+
function row_getDisplayIndex(row) {
|
|
10
|
+
const rows = row.table.getRowsInDisplayOrder();
|
|
11
|
+
const displayIndex = row._displayIndexCache;
|
|
12
|
+
return rows[displayIndex] === row ? displayIndex : -1;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Returns the rows in the current display order after assigning their
|
|
16
|
+
* zero-based display indexes.
|
|
17
|
+
*
|
|
18
|
+
* When expanded rows bypass pagination, expanded descendants are inserted into
|
|
19
|
+
* the returned order even though they are absent from the pre-pagination row
|
|
20
|
+
* model.
|
|
21
|
+
*/
|
|
22
|
+
function table_getRowsInDisplayOrder(table) {
|
|
23
|
+
const rows = table.getPrePaginatedRowModel().rows;
|
|
24
|
+
if (table.options.paginateExpandedRows === false) {
|
|
25
|
+
const displayRows = [];
|
|
26
|
+
const handleRow = (row) => {
|
|
27
|
+
row._displayIndexCache = displayRows.length;
|
|
28
|
+
displayRows.push(row);
|
|
29
|
+
if (row.subRows.length && row.getIsExpanded?.()) row.subRows.forEach(handleRow);
|
|
30
|
+
};
|
|
31
|
+
rows.forEach(handleRow);
|
|
32
|
+
return displayRows;
|
|
33
|
+
}
|
|
34
|
+
for (let i = 0; i < rows.length; i++) rows[i]._displayIndexCache = i;
|
|
35
|
+
return rows;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
6
38
|
* Reads and caches this row's value for a column.
|
|
7
39
|
*
|
|
8
40
|
* The value is produced by the column accessor. Missing columns or display
|
|
@@ -190,6 +222,7 @@ function table_getRow(table, rowId, searchAll) {
|
|
|
190
222
|
//#endregion
|
|
191
223
|
exports.row_getAllCells = row_getAllCells;
|
|
192
224
|
exports.row_getAllCellsByColumnId = row_getAllCellsByColumnId;
|
|
225
|
+
exports.row_getDisplayIndex = row_getDisplayIndex;
|
|
193
226
|
exports.row_getLeafRows = row_getLeafRows;
|
|
194
227
|
exports.row_getParentRow = row_getParentRow;
|
|
195
228
|
exports.row_getParentRows = row_getParentRows;
|
|
@@ -198,4 +231,5 @@ exports.row_getValue = row_getValue;
|
|
|
198
231
|
exports.row_renderValue = row_renderValue;
|
|
199
232
|
exports.table_getRow = table_getRow;
|
|
200
233
|
exports.table_getRowId = table_getRowId;
|
|
234
|
+
exports.table_getRowsInDisplayOrder = table_getRowsInDisplayOrder;
|
|
201
235
|
//# sourceMappingURL=coreRowsFeature.utils.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coreRowsFeature.utils.cjs","names":["hasOwn","flattenBy","constructCell","makeObjectMap"],"sources":["../../../src/core/rows/coreRowsFeature.utils.ts"],"sourcesContent":["import { flattenBy, hasOwn, makeObjectMap } from '../../utils'\nimport { constructCell } from '../cells/constructCell'\nimport type { Table_Internal } from '../../types/Table'\nimport type { RowData } from '../../types/type-utils'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { Row } from '../../types/Row'\nimport type { Cell } from '../../types/Cell'\n\n/**\n * Reads and caches this row's value for a column.\n *\n * The value is produced by the column accessor. Missing columns or display\n * columns without an accessor return `undefined`.\n *\n * @example\n * ```ts\n * const firstName = row_getValue(row, 'firstName')\n * ```\n */\nexport function row_getValue<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>, columnId: string) {\n if (hasOwn(row._valuesCache, columnId)) {\n return row._valuesCache[columnId]\n }\n\n const column = row.table.getColumn(columnId)\n\n if (!column?.accessorFn) {\n return undefined\n }\n\n row._valuesCache[columnId] = column.accessorFn(row.original, row.index)\n\n return row._valuesCache[columnId]\n}\n\n/**\n * Reads and caches the values used by faceting/grouping for a column.\n *\n * If the column defines `getUniqueValues`, that result is used. Otherwise the\n * row's accessor value is wrapped in a single-item array.\n *\n * @example\n * ```ts\n * const values = row_getUniqueValues(row, 'tags')\n * ```\n */\nexport function row_getUniqueValues<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>, columnId: string) {\n if (hasOwn(row._uniqueValuesCache, columnId)) {\n return row._uniqueValuesCache[columnId]\n }\n\n const column = row.table.getColumn(columnId)\n\n if (!column?.accessorFn) {\n return undefined\n }\n\n if (!column.columnDef.getUniqueValues) {\n row._uniqueValuesCache[columnId] = [row.getValue(columnId)]\n return row._uniqueValuesCache[columnId]\n }\n\n row._uniqueValuesCache[columnId] = column.columnDef.getUniqueValues(\n row.original,\n row.index,\n )\n\n return row._uniqueValuesCache[columnId]\n}\n\n/**\n * Returns a renderable row value for a column.\n *\n * If the accessor value is nullish, the table's `renderFallbackValue` is used\n * instead.\n *\n * @example\n * ```ts\n * const value = row_renderValue(row, 'firstName')\n * ```\n */\nexport function row_renderValue<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>, columnId: string) {\n return row.getValue(columnId) ?? row.table.options.renderFallbackValue\n}\n\n/**\n * Flattens this row's descendant tree into leaf rows.\n *\n * The row itself is not included; only nested `subRows` are walked.\n *\n * @example\n * ```ts\n * const descendants = row_getLeafRows(row)\n * ```\n */\nexport function row_getLeafRows<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>): Array<Row<TFeatures, TData>> {\n return flattenBy(row.subRows, (d) => d.subRows)\n}\n\n/**\n * Looks up this row's direct parent, if it has one.\n *\n * Parent lookup searches the pre-pagination row model so parent relationships\n * are available even when the parent is not on the current page.\n *\n * @example\n * ```ts\n * const parent = row_getParentRow(row)\n * ```\n */\nexport function row_getParentRow<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>) {\n return row.parentId ? row.table.getRow(row.parentId, true) : undefined\n}\n\n/**\n * Collects this row's ancestor chain from root to direct parent.\n *\n * The current row is not included. Rows without a parent return an empty array.\n *\n * @example\n * ```ts\n * const ancestors = row_getParentRows(row)\n * ```\n */\nexport function row_getParentRows<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>) {\n const parentRows: Array<Row<TFeatures, TData>> = []\n let currentRow = row\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n while (true) {\n const parentRow = currentRow.getParentRow()\n if (!parentRow) break\n parentRows.push(parentRow)\n currentRow = parentRow\n }\n return parentRows.reverse()\n}\n\n/**\n * Constructs one cell for each leaf column in this row.\n *\n * The result follows `table.getAllLeafColumns()` order and includes hidden\n * columns; visibility-specific APIs filter this list later.\n *\n * @example\n * ```ts\n * const cells = row_getAllCells(row)\n * ```\n */\nexport function row_getAllCells<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>): Array<Cell<TFeatures, TData, unknown>> {\n const columns = row.table.getAllLeafColumns()\n // WeakMap so cells keyed by replaced column instances can be collected;\n // rows are memoized on data only and outlive column generations\n let cache = row._cellsCache\n if (!cache) {\n cache = row._cellsCache = new WeakMap()\n }\n const cells: Array<Cell<TFeatures, TData, unknown>> = new Array(\n columns.length,\n )\n for (let i = 0; i < columns.length; i++) {\n const column = columns[i]!\n let cell = cache.get(column)\n if (!cell) {\n cell = constructCell(column, row, row.table)\n cache.set(column, cell)\n }\n cells[i] = cell\n }\n return cells\n}\n\n/**\n * Builds a lookup map of this row's cells keyed by column id.\n *\n * This is the static implementation behind `row.getAllCellsByColumnId()`.\n *\n * @example\n * ```ts\n * const cellsById = row_getAllCellsByColumnId(row)\n * ```\n */\nexport function row_getAllCellsByColumnId<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>) {\n const result = makeObjectMap<Cell<TFeatures, TData, unknown>>()\n const cells = row.getAllCells()\n for (let i = 0; i < cells.length; i++) {\n const cell = cells[i]!\n result[cell.column.id] = cell\n }\n return result\n}\n\n/**\n * Resolves the stable id for a row.\n *\n * `options.getRowId` wins when provided. Otherwise root rows use their index\n * and child rows append their index to the parent id, such as `0.2`.\n *\n * @example\n * ```ts\n * const id = table_getRowId(originalRow, table, index, parentRow)\n * ```\n */\nexport function table_getRowId<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n originalRow: TData,\n table: Table_Internal<TFeatures, TData>,\n index: number,\n parent?: Row<TFeatures, TData>,\n) {\n return (\n table.options.getRowId?.(originalRow, index, parent) ??\n `${parent ? [parent.id, index].join('.') : index}`\n )\n}\n\n/**\n * Looks up a row by id from the current or full row model.\n *\n * By default this searches `table.getRowModel()`. Passing `searchAll` searches\n * the pre-pagination model first, then falls back to the core model.\n *\n * @example\n * ```ts\n * const row = table_getRow(table, rowId, true)\n * ```\n */\nexport function table_getRow<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n rowId: string,\n searchAll?: boolean,\n): Row<TFeatures, TData> {\n // TODO - simplify this across different row models\n let row = (searchAll ? table.getPrePaginatedRowModel() : table.getRowModel())\n .rowsById[rowId]\n\n if (!row) {\n row = table.getCoreRowModel().rowsById[rowId]\n if (!row) {\n if (process.env.NODE_ENV === 'development') {\n throw new Error(`getRow could not find row with ID: ${rowId}`)\n }\n throw new Error()\n }\n }\n\n return row\n}\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"coreRowsFeature.utils.cjs","names":["hasOwn","flattenBy","constructCell","makeObjectMap"],"sources":["../../../src/core/rows/coreRowsFeature.utils.ts"],"sourcesContent":["import { flattenBy, hasOwn, makeObjectMap } from '../../utils'\nimport { constructCell } from '../cells/constructCell'\nimport type { Table_Internal } from '../../types/Table'\nimport type { RowData } from '../../types/type-utils'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { Row } from '../../types/Row'\nimport type { Cell } from '../../types/Cell'\nimport type { Row_RowExpanding } from '../../features/row-expanding/rowExpandingFeature.types'\n\n/**\n * Returns this row's zero-based position in the current pre-pagination row\n * model. Rows outside that model return `-1`.\n */\nexport function row_getDisplayIndex<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>) {\n const rows = row.table.getRowsInDisplayOrder()\n const displayIndex = row._displayIndexCache\n\n return rows[displayIndex] === row ? displayIndex : -1\n}\n\n/**\n * Returns the rows in the current display order after assigning their\n * zero-based display indexes.\n *\n * When expanded rows bypass pagination, expanded descendants are inserted into\n * the returned order even though they are absent from the pre-pagination row\n * model.\n */\nexport function table_getRowsInDisplayOrder<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n const rows = table.getPrePaginatedRowModel().rows\n\n if (table.options.paginateExpandedRows === false) {\n const displayRows: Array<Row<TFeatures, TData>> = []\n\n const handleRow = (row: Row<TFeatures, TData>) => {\n row._displayIndexCache = displayRows.length\n displayRows.push(row)\n\n if (\n row.subRows.length &&\n (\n row as Row<TFeatures, TData> & Partial<Row_RowExpanding>\n ).getIsExpanded?.()\n ) {\n row.subRows.forEach(handleRow)\n }\n }\n\n rows.forEach(handleRow)\n\n return displayRows\n }\n\n for (let i = 0; i < rows.length; i++) {\n rows[i]!._displayIndexCache = i\n }\n\n return rows\n}\n\n/**\n * Reads and caches this row's value for a column.\n *\n * The value is produced by the column accessor. Missing columns or display\n * columns without an accessor return `undefined`.\n *\n * @example\n * ```ts\n * const firstName = row_getValue(row, 'firstName')\n * ```\n */\nexport function row_getValue<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>, columnId: string) {\n if (hasOwn(row._valuesCache, columnId)) {\n return row._valuesCache[columnId]\n }\n\n const column = row.table.getColumn(columnId)\n\n if (!column?.accessorFn) {\n return undefined\n }\n\n row._valuesCache[columnId] = column.accessorFn(row.original, row.index)\n\n return row._valuesCache[columnId]\n}\n\n/**\n * Reads and caches the values used by faceting/grouping for a column.\n *\n * If the column defines `getUniqueValues`, that result is used. Otherwise the\n * row's accessor value is wrapped in a single-item array.\n *\n * @example\n * ```ts\n * const values = row_getUniqueValues(row, 'tags')\n * ```\n */\nexport function row_getUniqueValues<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>, columnId: string) {\n if (hasOwn(row._uniqueValuesCache, columnId)) {\n return row._uniqueValuesCache[columnId]\n }\n\n const column = row.table.getColumn(columnId)\n\n if (!column?.accessorFn) {\n return undefined\n }\n\n if (!column.columnDef.getUniqueValues) {\n row._uniqueValuesCache[columnId] = [row.getValue(columnId)]\n return row._uniqueValuesCache[columnId]\n }\n\n row._uniqueValuesCache[columnId] = column.columnDef.getUniqueValues(\n row.original,\n row.index,\n )\n\n return row._uniqueValuesCache[columnId]\n}\n\n/**\n * Returns a renderable row value for a column.\n *\n * If the accessor value is nullish, the table's `renderFallbackValue` is used\n * instead.\n *\n * @example\n * ```ts\n * const value = row_renderValue(row, 'firstName')\n * ```\n */\nexport function row_renderValue<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>, columnId: string) {\n return row.getValue(columnId) ?? row.table.options.renderFallbackValue\n}\n\n/**\n * Flattens this row's descendant tree into leaf rows.\n *\n * The row itself is not included; only nested `subRows` are walked.\n *\n * @example\n * ```ts\n * const descendants = row_getLeafRows(row)\n * ```\n */\nexport function row_getLeafRows<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>): Array<Row<TFeatures, TData>> {\n return flattenBy(row.subRows, (d) => d.subRows)\n}\n\n/**\n * Looks up this row's direct parent, if it has one.\n *\n * Parent lookup searches the pre-pagination row model so parent relationships\n * are available even when the parent is not on the current page.\n *\n * @example\n * ```ts\n * const parent = row_getParentRow(row)\n * ```\n */\nexport function row_getParentRow<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>) {\n return row.parentId ? row.table.getRow(row.parentId, true) : undefined\n}\n\n/**\n * Collects this row's ancestor chain from root to direct parent.\n *\n * The current row is not included. Rows without a parent return an empty array.\n *\n * @example\n * ```ts\n * const ancestors = row_getParentRows(row)\n * ```\n */\nexport function row_getParentRows<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>) {\n const parentRows: Array<Row<TFeatures, TData>> = []\n let currentRow = row\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n while (true) {\n const parentRow = currentRow.getParentRow()\n if (!parentRow) break\n parentRows.push(parentRow)\n currentRow = parentRow\n }\n return parentRows.reverse()\n}\n\n/**\n * Constructs one cell for each leaf column in this row.\n *\n * The result follows `table.getAllLeafColumns()` order and includes hidden\n * columns; visibility-specific APIs filter this list later.\n *\n * @example\n * ```ts\n * const cells = row_getAllCells(row)\n * ```\n */\nexport function row_getAllCells<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>): Array<Cell<TFeatures, TData, unknown>> {\n const columns = row.table.getAllLeafColumns()\n // WeakMap so cells keyed by replaced column instances can be collected;\n // rows are memoized on data only and outlive column generations\n let cache = row._cellsCache\n if (!cache) {\n cache = row._cellsCache = new WeakMap()\n }\n const cells: Array<Cell<TFeatures, TData, unknown>> = new Array(\n columns.length,\n )\n for (let i = 0; i < columns.length; i++) {\n const column = columns[i]!\n let cell = cache.get(column)\n if (!cell) {\n cell = constructCell(column, row, row.table)\n cache.set(column, cell)\n }\n cells[i] = cell\n }\n return cells\n}\n\n/**\n * Builds a lookup map of this row's cells keyed by column id.\n *\n * This is the static implementation behind `row.getAllCellsByColumnId()`.\n *\n * @example\n * ```ts\n * const cellsById = row_getAllCellsByColumnId(row)\n * ```\n */\nexport function row_getAllCellsByColumnId<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>) {\n const result = makeObjectMap<Cell<TFeatures, TData, unknown>>()\n const cells = row.getAllCells()\n for (let i = 0; i < cells.length; i++) {\n const cell = cells[i]!\n result[cell.column.id] = cell\n }\n return result\n}\n\n/**\n * Resolves the stable id for a row.\n *\n * `options.getRowId` wins when provided. Otherwise root rows use their index\n * and child rows append their index to the parent id, such as `0.2`.\n *\n * @example\n * ```ts\n * const id = table_getRowId(originalRow, table, index, parentRow)\n * ```\n */\nexport function table_getRowId<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n originalRow: TData,\n table: Table_Internal<TFeatures, TData>,\n index: number,\n parent?: Row<TFeatures, TData>,\n) {\n return (\n table.options.getRowId?.(originalRow, index, parent) ??\n `${parent ? [parent.id, index].join('.') : index}`\n )\n}\n\n/**\n * Looks up a row by id from the current or full row model.\n *\n * By default this searches `table.getRowModel()`. Passing `searchAll` searches\n * the pre-pagination model first, then falls back to the core model.\n *\n * @example\n * ```ts\n * const row = table_getRow(table, rowId, true)\n * ```\n */\nexport function table_getRow<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n rowId: string,\n searchAll?: boolean,\n): Row<TFeatures, TData> {\n // TODO - simplify this across different row models\n let row = (searchAll ? table.getPrePaginatedRowModel() : table.getRowModel())\n .rowsById[rowId]\n\n if (!row) {\n row = table.getCoreRowModel().rowsById[rowId]\n if (!row) {\n if (process.env.NODE_ENV === 'development') {\n throw new Error(`getRow could not find row with ID: ${rowId}`)\n }\n throw new Error()\n }\n }\n\n return row\n}\n"],"mappings":"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"}
|
|
@@ -5,6 +5,20 @@ import { Table } from "../../types/Table.cjs";
|
|
|
5
5
|
import { TableFeatures } from "../../types/TableFeatures.cjs";
|
|
6
6
|
|
|
7
7
|
//#region src/core/rows/coreRowsFeature.utils.d.ts
|
|
8
|
+
/**
|
|
9
|
+
* Returns this row's zero-based position in the current pre-pagination row
|
|
10
|
+
* model. Rows outside that model return `-1`.
|
|
11
|
+
*/
|
|
12
|
+
declare function row_getDisplayIndex<TFeatures extends TableFeatures, TData extends RowData>(row: Row<TFeatures, TData>): number;
|
|
13
|
+
/**
|
|
14
|
+
* Returns the rows in the current display order after assigning their
|
|
15
|
+
* zero-based display indexes.
|
|
16
|
+
*
|
|
17
|
+
* When expanded rows bypass pagination, expanded descendants are inserted into
|
|
18
|
+
* the returned order even though they are absent from the pre-pagination row
|
|
19
|
+
* model.
|
|
20
|
+
*/
|
|
21
|
+
declare function table_getRowsInDisplayOrder<TFeatures extends TableFeatures, TData extends RowData>(table: Table<TFeatures, TData>): Row<TFeatures, TData>[];
|
|
8
22
|
/**
|
|
9
23
|
* Reads and caches this row's value for a column.
|
|
10
24
|
*
|
|
@@ -123,5 +137,5 @@ declare function table_getRowId<TFeatures extends TableFeatures, TData extends R
|
|
|
123
137
|
*/
|
|
124
138
|
declare function table_getRow<TFeatures extends TableFeatures, TData extends RowData>(table: Table<TFeatures, TData>, rowId: string, searchAll?: boolean): Row<TFeatures, TData>;
|
|
125
139
|
//#endregion
|
|
126
|
-
export { row_getAllCells, row_getAllCellsByColumnId, row_getLeafRows, row_getParentRow, row_getParentRows, row_getUniqueValues, row_getValue, row_renderValue, table_getRow, table_getRowId };
|
|
140
|
+
export { row_getAllCells, row_getAllCellsByColumnId, row_getDisplayIndex, row_getLeafRows, row_getParentRow, row_getParentRows, row_getUniqueValues, row_getValue, row_renderValue, table_getRow, table_getRowId, table_getRowsInDisplayOrder };
|
|
127
141
|
//# sourceMappingURL=coreRowsFeature.utils.d.cts.map
|
|
@@ -5,6 +5,20 @@ import { Table } from "../../types/Table.js";
|
|
|
5
5
|
import { TableFeatures } from "../../types/TableFeatures.js";
|
|
6
6
|
|
|
7
7
|
//#region src/core/rows/coreRowsFeature.utils.d.ts
|
|
8
|
+
/**
|
|
9
|
+
* Returns this row's zero-based position in the current pre-pagination row
|
|
10
|
+
* model. Rows outside that model return `-1`.
|
|
11
|
+
*/
|
|
12
|
+
declare function row_getDisplayIndex<TFeatures extends TableFeatures, TData extends RowData>(row: Row<TFeatures, TData>): number;
|
|
13
|
+
/**
|
|
14
|
+
* Returns the rows in the current display order after assigning their
|
|
15
|
+
* zero-based display indexes.
|
|
16
|
+
*
|
|
17
|
+
* When expanded rows bypass pagination, expanded descendants are inserted into
|
|
18
|
+
* the returned order even though they are absent from the pre-pagination row
|
|
19
|
+
* model.
|
|
20
|
+
*/
|
|
21
|
+
declare function table_getRowsInDisplayOrder<TFeatures extends TableFeatures, TData extends RowData>(table: Table<TFeatures, TData>): Row<TFeatures, TData>[];
|
|
8
22
|
/**
|
|
9
23
|
* Reads and caches this row's value for a column.
|
|
10
24
|
*
|
|
@@ -123,5 +137,5 @@ declare function table_getRowId<TFeatures extends TableFeatures, TData extends R
|
|
|
123
137
|
*/
|
|
124
138
|
declare function table_getRow<TFeatures extends TableFeatures, TData extends RowData>(table: Table<TFeatures, TData>, rowId: string, searchAll?: boolean): Row<TFeatures, TData>;
|
|
125
139
|
//#endregion
|
|
126
|
-
export { row_getAllCells, row_getAllCellsByColumnId, row_getLeafRows, row_getParentRow, row_getParentRows, row_getUniqueValues, row_getValue, row_renderValue, table_getRow, table_getRowId };
|
|
140
|
+
export { row_getAllCells, row_getAllCellsByColumnId, row_getDisplayIndex, row_getLeafRows, row_getParentRow, row_getParentRows, row_getUniqueValues, row_getValue, row_renderValue, table_getRow, table_getRowId, table_getRowsInDisplayOrder };
|
|
127
141
|
//# sourceMappingURL=coreRowsFeature.utils.d.ts.map
|
|
@@ -3,6 +3,38 @@ import { constructCell } from "../cells/constructCell.js";
|
|
|
3
3
|
|
|
4
4
|
//#region src/core/rows/coreRowsFeature.utils.ts
|
|
5
5
|
/**
|
|
6
|
+
* Returns this row's zero-based position in the current pre-pagination row
|
|
7
|
+
* model. Rows outside that model return `-1`.
|
|
8
|
+
*/
|
|
9
|
+
function row_getDisplayIndex(row) {
|
|
10
|
+
const rows = row.table.getRowsInDisplayOrder();
|
|
11
|
+
const displayIndex = row._displayIndexCache;
|
|
12
|
+
return rows[displayIndex] === row ? displayIndex : -1;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Returns the rows in the current display order after assigning their
|
|
16
|
+
* zero-based display indexes.
|
|
17
|
+
*
|
|
18
|
+
* When expanded rows bypass pagination, expanded descendants are inserted into
|
|
19
|
+
* the returned order even though they are absent from the pre-pagination row
|
|
20
|
+
* model.
|
|
21
|
+
*/
|
|
22
|
+
function table_getRowsInDisplayOrder(table) {
|
|
23
|
+
const rows = table.getPrePaginatedRowModel().rows;
|
|
24
|
+
if (table.options.paginateExpandedRows === false) {
|
|
25
|
+
const displayRows = [];
|
|
26
|
+
const handleRow = (row) => {
|
|
27
|
+
row._displayIndexCache = displayRows.length;
|
|
28
|
+
displayRows.push(row);
|
|
29
|
+
if (row.subRows.length && row.getIsExpanded?.()) row.subRows.forEach(handleRow);
|
|
30
|
+
};
|
|
31
|
+
rows.forEach(handleRow);
|
|
32
|
+
return displayRows;
|
|
33
|
+
}
|
|
34
|
+
for (let i = 0; i < rows.length; i++) rows[i]._displayIndexCache = i;
|
|
35
|
+
return rows;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
6
38
|
* Reads and caches this row's value for a column.
|
|
7
39
|
*
|
|
8
40
|
* The value is produced by the column accessor. Missing columns or display
|
|
@@ -188,5 +220,5 @@ function table_getRow(table, rowId, searchAll) {
|
|
|
188
220
|
}
|
|
189
221
|
|
|
190
222
|
//#endregion
|
|
191
|
-
export { row_getAllCells, row_getAllCellsByColumnId, row_getLeafRows, row_getParentRow, row_getParentRows, row_getUniqueValues, row_getValue, row_renderValue, table_getRow, table_getRowId };
|
|
223
|
+
export { row_getAllCells, row_getAllCellsByColumnId, row_getDisplayIndex, row_getLeafRows, row_getParentRow, row_getParentRows, row_getUniqueValues, row_getValue, row_renderValue, table_getRow, table_getRowId, table_getRowsInDisplayOrder };
|
|
192
224
|
//# sourceMappingURL=coreRowsFeature.utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coreRowsFeature.utils.js","names":[],"sources":["../../../src/core/rows/coreRowsFeature.utils.ts"],"sourcesContent":["import { flattenBy, hasOwn, makeObjectMap } from '../../utils'\nimport { constructCell } from '../cells/constructCell'\nimport type { Table_Internal } from '../../types/Table'\nimport type { RowData } from '../../types/type-utils'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { Row } from '../../types/Row'\nimport type { Cell } from '../../types/Cell'\n\n/**\n * Reads and caches this row's value for a column.\n *\n * The value is produced by the column accessor. Missing columns or display\n * columns without an accessor return `undefined`.\n *\n * @example\n * ```ts\n * const firstName = row_getValue(row, 'firstName')\n * ```\n */\nexport function row_getValue<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>, columnId: string) {\n if (hasOwn(row._valuesCache, columnId)) {\n return row._valuesCache[columnId]\n }\n\n const column = row.table.getColumn(columnId)\n\n if (!column?.accessorFn) {\n return undefined\n }\n\n row._valuesCache[columnId] = column.accessorFn(row.original, row.index)\n\n return row._valuesCache[columnId]\n}\n\n/**\n * Reads and caches the values used by faceting/grouping for a column.\n *\n * If the column defines `getUniqueValues`, that result is used. Otherwise the\n * row's accessor value is wrapped in a single-item array.\n *\n * @example\n * ```ts\n * const values = row_getUniqueValues(row, 'tags')\n * ```\n */\nexport function row_getUniqueValues<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>, columnId: string) {\n if (hasOwn(row._uniqueValuesCache, columnId)) {\n return row._uniqueValuesCache[columnId]\n }\n\n const column = row.table.getColumn(columnId)\n\n if (!column?.accessorFn) {\n return undefined\n }\n\n if (!column.columnDef.getUniqueValues) {\n row._uniqueValuesCache[columnId] = [row.getValue(columnId)]\n return row._uniqueValuesCache[columnId]\n }\n\n row._uniqueValuesCache[columnId] = column.columnDef.getUniqueValues(\n row.original,\n row.index,\n )\n\n return row._uniqueValuesCache[columnId]\n}\n\n/**\n * Returns a renderable row value for a column.\n *\n * If the accessor value is nullish, the table's `renderFallbackValue` is used\n * instead.\n *\n * @example\n * ```ts\n * const value = row_renderValue(row, 'firstName')\n * ```\n */\nexport function row_renderValue<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>, columnId: string) {\n return row.getValue(columnId) ?? row.table.options.renderFallbackValue\n}\n\n/**\n * Flattens this row's descendant tree into leaf rows.\n *\n * The row itself is not included; only nested `subRows` are walked.\n *\n * @example\n * ```ts\n * const descendants = row_getLeafRows(row)\n * ```\n */\nexport function row_getLeafRows<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>): Array<Row<TFeatures, TData>> {\n return flattenBy(row.subRows, (d) => d.subRows)\n}\n\n/**\n * Looks up this row's direct parent, if it has one.\n *\n * Parent lookup searches the pre-pagination row model so parent relationships\n * are available even when the parent is not on the current page.\n *\n * @example\n * ```ts\n * const parent = row_getParentRow(row)\n * ```\n */\nexport function row_getParentRow<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>) {\n return row.parentId ? row.table.getRow(row.parentId, true) : undefined\n}\n\n/**\n * Collects this row's ancestor chain from root to direct parent.\n *\n * The current row is not included. Rows without a parent return an empty array.\n *\n * @example\n * ```ts\n * const ancestors = row_getParentRows(row)\n * ```\n */\nexport function row_getParentRows<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>) {\n const parentRows: Array<Row<TFeatures, TData>> = []\n let currentRow = row\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n while (true) {\n const parentRow = currentRow.getParentRow()\n if (!parentRow) break\n parentRows.push(parentRow)\n currentRow = parentRow\n }\n return parentRows.reverse()\n}\n\n/**\n * Constructs one cell for each leaf column in this row.\n *\n * The result follows `table.getAllLeafColumns()` order and includes hidden\n * columns; visibility-specific APIs filter this list later.\n *\n * @example\n * ```ts\n * const cells = row_getAllCells(row)\n * ```\n */\nexport function row_getAllCells<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>): Array<Cell<TFeatures, TData, unknown>> {\n const columns = row.table.getAllLeafColumns()\n // WeakMap so cells keyed by replaced column instances can be collected;\n // rows are memoized on data only and outlive column generations\n let cache = row._cellsCache\n if (!cache) {\n cache = row._cellsCache = new WeakMap()\n }\n const cells: Array<Cell<TFeatures, TData, unknown>> = new Array(\n columns.length,\n )\n for (let i = 0; i < columns.length; i++) {\n const column = columns[i]!\n let cell = cache.get(column)\n if (!cell) {\n cell = constructCell(column, row, row.table)\n cache.set(column, cell)\n }\n cells[i] = cell\n }\n return cells\n}\n\n/**\n * Builds a lookup map of this row's cells keyed by column id.\n *\n * This is the static implementation behind `row.getAllCellsByColumnId()`.\n *\n * @example\n * ```ts\n * const cellsById = row_getAllCellsByColumnId(row)\n * ```\n */\nexport function row_getAllCellsByColumnId<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>) {\n const result = makeObjectMap<Cell<TFeatures, TData, unknown>>()\n const cells = row.getAllCells()\n for (let i = 0; i < cells.length; i++) {\n const cell = cells[i]!\n result[cell.column.id] = cell\n }\n return result\n}\n\n/**\n * Resolves the stable id for a row.\n *\n * `options.getRowId` wins when provided. Otherwise root rows use their index\n * and child rows append their index to the parent id, such as `0.2`.\n *\n * @example\n * ```ts\n * const id = table_getRowId(originalRow, table, index, parentRow)\n * ```\n */\nexport function table_getRowId<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n originalRow: TData,\n table: Table_Internal<TFeatures, TData>,\n index: number,\n parent?: Row<TFeatures, TData>,\n) {\n return (\n table.options.getRowId?.(originalRow, index, parent) ??\n `${parent ? [parent.id, index].join('.') : index}`\n )\n}\n\n/**\n * Looks up a row by id from the current or full row model.\n *\n * By default this searches `table.getRowModel()`. Passing `searchAll` searches\n * the pre-pagination model first, then falls back to the core model.\n *\n * @example\n * ```ts\n * const row = table_getRow(table, rowId, true)\n * ```\n */\nexport function table_getRow<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n rowId: string,\n searchAll?: boolean,\n): Row<TFeatures, TData> {\n // TODO - simplify this across different row models\n let row = (searchAll ? table.getPrePaginatedRowModel() : table.getRowModel())\n .rowsById[rowId]\n\n if (!row) {\n row = table.getCoreRowModel().rowsById[rowId]\n if (!row) {\n if (process.env.NODE_ENV === 'development') {\n throw new Error(`getRow could not find row with ID: ${rowId}`)\n }\n throw new Error()\n }\n }\n\n return row\n}\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"coreRowsFeature.utils.js","names":[],"sources":["../../../src/core/rows/coreRowsFeature.utils.ts"],"sourcesContent":["import { flattenBy, hasOwn, makeObjectMap } from '../../utils'\nimport { constructCell } from '../cells/constructCell'\nimport type { Table_Internal } from '../../types/Table'\nimport type { RowData } from '../../types/type-utils'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { Row } from '../../types/Row'\nimport type { Cell } from '../../types/Cell'\nimport type { Row_RowExpanding } from '../../features/row-expanding/rowExpandingFeature.types'\n\n/**\n * Returns this row's zero-based position in the current pre-pagination row\n * model. Rows outside that model return `-1`.\n */\nexport function row_getDisplayIndex<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>) {\n const rows = row.table.getRowsInDisplayOrder()\n const displayIndex = row._displayIndexCache\n\n return rows[displayIndex] === row ? displayIndex : -1\n}\n\n/**\n * Returns the rows in the current display order after assigning their\n * zero-based display indexes.\n *\n * When expanded rows bypass pagination, expanded descendants are inserted into\n * the returned order even though they are absent from the pre-pagination row\n * model.\n */\nexport function table_getRowsInDisplayOrder<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n const rows = table.getPrePaginatedRowModel().rows\n\n if (table.options.paginateExpandedRows === false) {\n const displayRows: Array<Row<TFeatures, TData>> = []\n\n const handleRow = (row: Row<TFeatures, TData>) => {\n row._displayIndexCache = displayRows.length\n displayRows.push(row)\n\n if (\n row.subRows.length &&\n (\n row as Row<TFeatures, TData> & Partial<Row_RowExpanding>\n ).getIsExpanded?.()\n ) {\n row.subRows.forEach(handleRow)\n }\n }\n\n rows.forEach(handleRow)\n\n return displayRows\n }\n\n for (let i = 0; i < rows.length; i++) {\n rows[i]!._displayIndexCache = i\n }\n\n return rows\n}\n\n/**\n * Reads and caches this row's value for a column.\n *\n * The value is produced by the column accessor. Missing columns or display\n * columns without an accessor return `undefined`.\n *\n * @example\n * ```ts\n * const firstName = row_getValue(row, 'firstName')\n * ```\n */\nexport function row_getValue<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>, columnId: string) {\n if (hasOwn(row._valuesCache, columnId)) {\n return row._valuesCache[columnId]\n }\n\n const column = row.table.getColumn(columnId)\n\n if (!column?.accessorFn) {\n return undefined\n }\n\n row._valuesCache[columnId] = column.accessorFn(row.original, row.index)\n\n return row._valuesCache[columnId]\n}\n\n/**\n * Reads and caches the values used by faceting/grouping for a column.\n *\n * If the column defines `getUniqueValues`, that result is used. Otherwise the\n * row's accessor value is wrapped in a single-item array.\n *\n * @example\n * ```ts\n * const values = row_getUniqueValues(row, 'tags')\n * ```\n */\nexport function row_getUniqueValues<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>, columnId: string) {\n if (hasOwn(row._uniqueValuesCache, columnId)) {\n return row._uniqueValuesCache[columnId]\n }\n\n const column = row.table.getColumn(columnId)\n\n if (!column?.accessorFn) {\n return undefined\n }\n\n if (!column.columnDef.getUniqueValues) {\n row._uniqueValuesCache[columnId] = [row.getValue(columnId)]\n return row._uniqueValuesCache[columnId]\n }\n\n row._uniqueValuesCache[columnId] = column.columnDef.getUniqueValues(\n row.original,\n row.index,\n )\n\n return row._uniqueValuesCache[columnId]\n}\n\n/**\n * Returns a renderable row value for a column.\n *\n * If the accessor value is nullish, the table's `renderFallbackValue` is used\n * instead.\n *\n * @example\n * ```ts\n * const value = row_renderValue(row, 'firstName')\n * ```\n */\nexport function row_renderValue<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>, columnId: string) {\n return row.getValue(columnId) ?? row.table.options.renderFallbackValue\n}\n\n/**\n * Flattens this row's descendant tree into leaf rows.\n *\n * The row itself is not included; only nested `subRows` are walked.\n *\n * @example\n * ```ts\n * const descendants = row_getLeafRows(row)\n * ```\n */\nexport function row_getLeafRows<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>): Array<Row<TFeatures, TData>> {\n return flattenBy(row.subRows, (d) => d.subRows)\n}\n\n/**\n * Looks up this row's direct parent, if it has one.\n *\n * Parent lookup searches the pre-pagination row model so parent relationships\n * are available even when the parent is not on the current page.\n *\n * @example\n * ```ts\n * const parent = row_getParentRow(row)\n * ```\n */\nexport function row_getParentRow<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>) {\n return row.parentId ? row.table.getRow(row.parentId, true) : undefined\n}\n\n/**\n * Collects this row's ancestor chain from root to direct parent.\n *\n * The current row is not included. Rows without a parent return an empty array.\n *\n * @example\n * ```ts\n * const ancestors = row_getParentRows(row)\n * ```\n */\nexport function row_getParentRows<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>) {\n const parentRows: Array<Row<TFeatures, TData>> = []\n let currentRow = row\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n while (true) {\n const parentRow = currentRow.getParentRow()\n if (!parentRow) break\n parentRows.push(parentRow)\n currentRow = parentRow\n }\n return parentRows.reverse()\n}\n\n/**\n * Constructs one cell for each leaf column in this row.\n *\n * The result follows `table.getAllLeafColumns()` order and includes hidden\n * columns; visibility-specific APIs filter this list later.\n *\n * @example\n * ```ts\n * const cells = row_getAllCells(row)\n * ```\n */\nexport function row_getAllCells<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>): Array<Cell<TFeatures, TData, unknown>> {\n const columns = row.table.getAllLeafColumns()\n // WeakMap so cells keyed by replaced column instances can be collected;\n // rows are memoized on data only and outlive column generations\n let cache = row._cellsCache\n if (!cache) {\n cache = row._cellsCache = new WeakMap()\n }\n const cells: Array<Cell<TFeatures, TData, unknown>> = new Array(\n columns.length,\n )\n for (let i = 0; i < columns.length; i++) {\n const column = columns[i]!\n let cell = cache.get(column)\n if (!cell) {\n cell = constructCell(column, row, row.table)\n cache.set(column, cell)\n }\n cells[i] = cell\n }\n return cells\n}\n\n/**\n * Builds a lookup map of this row's cells keyed by column id.\n *\n * This is the static implementation behind `row.getAllCellsByColumnId()`.\n *\n * @example\n * ```ts\n * const cellsById = row_getAllCellsByColumnId(row)\n * ```\n */\nexport function row_getAllCellsByColumnId<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>) {\n const result = makeObjectMap<Cell<TFeatures, TData, unknown>>()\n const cells = row.getAllCells()\n for (let i = 0; i < cells.length; i++) {\n const cell = cells[i]!\n result[cell.column.id] = cell\n }\n return result\n}\n\n/**\n * Resolves the stable id for a row.\n *\n * `options.getRowId` wins when provided. Otherwise root rows use their index\n * and child rows append their index to the parent id, such as `0.2`.\n *\n * @example\n * ```ts\n * const id = table_getRowId(originalRow, table, index, parentRow)\n * ```\n */\nexport function table_getRowId<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n originalRow: TData,\n table: Table_Internal<TFeatures, TData>,\n index: number,\n parent?: Row<TFeatures, TData>,\n) {\n return (\n table.options.getRowId?.(originalRow, index, parent) ??\n `${parent ? [parent.id, index].join('.') : index}`\n )\n}\n\n/**\n * Looks up a row by id from the current or full row model.\n *\n * By default this searches `table.getRowModel()`. Passing `searchAll` searches\n * the pre-pagination model first, then falls back to the core model.\n *\n * @example\n * ```ts\n * const row = table_getRow(table, rowId, true)\n * ```\n */\nexport function table_getRow<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n rowId: string,\n searchAll?: boolean,\n): Row<TFeatures, TData> {\n // TODO - simplify this across different row models\n let row = (searchAll ? table.getPrePaginatedRowModel() : table.getRowModel())\n .rowsById[rowId]\n\n if (!row) {\n row = table.getCoreRowModel().rowsById[rowId]\n if (!row) {\n if (process.env.NODE_ENV === 'development') {\n throw new Error(`getRow could not find row with ID: ${rowId}`)\n }\n throw new Error()\n }\n }\n\n return row\n}\n"],"mappings":";;;;;;;;AAaA,SAAgB,oBAGd,KAA4B;CAC5B,MAAM,OAAO,IAAI,MAAM,sBAAsB;CAC7C,MAAM,eAAe,IAAI;CAEzB,OAAO,KAAK,kBAAkB,MAAM,eAAe;AACrD;;;;;;;;;AAUA,SAAgB,4BAGd,OAAyC;CACzC,MAAM,OAAO,MAAM,wBAAwB,CAAC,CAAC;CAE7C,IAAI,MAAM,QAAQ,yBAAyB,OAAO;EAChD,MAAM,cAA4C,CAAC;EAEnD,MAAM,aAAa,QAA+B;GAChD,IAAI,qBAAqB,YAAY;GACrC,YAAY,KAAK,GAAG;GAEpB,IACE,IAAI,QAAQ,UAEV,IACA,gBAAgB,GAElB,IAAI,QAAQ,QAAQ,SAAS;EAEjC;EAEA,KAAK,QAAQ,SAAS;EAEtB,OAAO;CACT;CAEA,KAAK,IAAI,IAAI,GAAG,IAAI,KAAK,QAAQ,KAC/B,KAAK,EAAE,CAAE,qBAAqB;CAGhC,OAAO;AACT;;;;;;;;;;;;AAaA,SAAgB,aAGd,KAA4B,UAAkB;CAC9C,IAAI,OAAO,IAAI,cAAc,QAAQ,GACnC,OAAO,IAAI,aAAa;CAG1B,MAAM,SAAS,IAAI,MAAM,UAAU,QAAQ;CAE3C,IAAI,CAAC,QAAQ,YACX;CAGF,IAAI,aAAa,YAAY,OAAO,WAAW,IAAI,UAAU,IAAI,KAAK;CAEtE,OAAO,IAAI,aAAa;AAC1B;;;;;;;;;;;;AAaA,SAAgB,oBAGd,KAA4B,UAAkB;CAC9C,IAAI,OAAO,IAAI,oBAAoB,QAAQ,GACzC,OAAO,IAAI,mBAAmB;CAGhC,MAAM,SAAS,IAAI,MAAM,UAAU,QAAQ;CAE3C,IAAI,CAAC,QAAQ,YACX;CAGF,IAAI,CAAC,OAAO,UAAU,iBAAiB;EACrC,IAAI,mBAAmB,YAAY,CAAC,IAAI,SAAS,QAAQ,CAAC;EAC1D,OAAO,IAAI,mBAAmB;CAChC;CAEA,IAAI,mBAAmB,YAAY,OAAO,UAAU,gBAClD,IAAI,UACJ,IAAI,KACN;CAEA,OAAO,IAAI,mBAAmB;AAChC;;;;;;;;;;;;AAaA,SAAgB,gBAGd,KAA4B,UAAkB;CAC9C,OAAO,IAAI,SAAS,QAAQ,KAAK,IAAI,MAAM,QAAQ;AACrD;;;;;;;;;;;AAYA,SAAgB,gBAGd,KAA0D;CAC1D,OAAO,UAAU,IAAI,UAAU,MAAM,EAAE,OAAO;AAChD;;;;;;;;;;;;AAaA,SAAgB,iBAGd,KAA4B;CAC5B,OAAO,IAAI,WAAW,IAAI,MAAM,OAAO,IAAI,UAAU,IAAI,IAAI;AAC/D;;;;;;;;;;;AAYA,SAAgB,kBAGd,KAA4B;CAC5B,MAAM,aAA2C,CAAC;CAClD,IAAI,aAAa;CAEjB,OAAO,MAAM;EACX,MAAM,YAAY,WAAW,aAAa;EAC1C,IAAI,CAAC,WAAW;EAChB,WAAW,KAAK,SAAS;EACzB,aAAa;CACf;CACA,OAAO,WAAW,QAAQ;AAC5B;;;;;;;;;;;;AAaA,SAAgB,gBAGd,KAAoE;CACpE,MAAM,UAAU,IAAI,MAAM,kBAAkB;CAG5C,IAAI,QAAQ,IAAI;CAChB,IAAI,CAAC,OACH,QAAQ,IAAI,8BAAc,IAAI,QAAQ;CAExC,MAAM,QAAgD,IAAI,MACxD,QAAQ,MACV;CACA,KAAK,IAAI,IAAI,GAAG,IAAI,QAAQ,QAAQ,KAAK;EACvC,MAAM,SAAS,QAAQ;EACvB,IAAI,OAAO,MAAM,IAAI,MAAM;EAC3B,IAAI,CAAC,MAAM;GACT,OAAO,cAAc,QAAQ,KAAK,IAAI,KAAK;GAC3C,MAAM,IAAI,QAAQ,IAAI;EACxB;EACA,MAAM,KAAK;CACb;CACA,OAAO;AACT;;;;;;;;;;;AAYA,SAAgB,0BAGd,KAA4B;CAC5B,MAAM,SAAS,cAA+C;CAC9D,MAAM,QAAQ,IAAI,YAAY;CAC9B,KAAK,IAAI,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK;EACrC,MAAM,OAAO,MAAM;EACnB,OAAO,KAAK,OAAO,MAAM;CAC3B;CACA,OAAO;AACT;;;;;;;;;;;;AAaA,SAAgB,eAId,aACA,OACA,OACA,QACA;CACA,OACE,MAAM,QAAQ,WAAW,aAAa,OAAO,MAAM,KACnD,GAAG,SAAS,CAAC,OAAO,IAAI,KAAK,CAAC,CAAC,KAAK,GAAG,IAAI;AAE/C;;;;;;;;;;;;AAaA,SAAgB,aAId,OACA,OACA,WACuB;CAEvB,IAAI,OAAO,YAAY,MAAM,wBAAwB,IAAI,MAAM,YAAY,EAAC,CACzE,SAAS;CAEZ,IAAI,CAAC,KAAK;EACR,MAAM,MAAM,gBAAgB,CAAC,CAAC,SAAS;EACvC,IAAI,CAAC,KAAK;GACR,IAAI,QAAQ,IAAI,aAAa,eAC3B,MAAM,IAAI,MAAM,sCAAsC,OAAO;GAE/D,MAAM,IAAI,MAAM;EAClB;CACF;CAEA,OAAO;AACT"}
|
|
@@ -106,6 +106,7 @@ exports.row_getCanPin = require_rowPinningFeature_utils.row_getCanPin;
|
|
|
106
106
|
exports.row_getCanSelect = require_rowSelectionFeature_utils.row_getCanSelect;
|
|
107
107
|
exports.row_getCanSelectSubRows = require_rowSelectionFeature_utils.row_getCanSelectSubRows;
|
|
108
108
|
exports.row_getCenterVisibleCells = require_columnPinningFeature_utils.row_getCenterVisibleCells;
|
|
109
|
+
exports.row_getDisplayIndex = require_coreRowsFeature_utils.row_getDisplayIndex;
|
|
109
110
|
exports.row_getEndVisibleCells = require_columnPinningFeature_utils.row_getEndVisibleCells;
|
|
110
111
|
exports.row_getGroupingValue = require_columnGroupingFeature_utils.row_getGroupingValue;
|
|
111
112
|
exports.row_getIsAllParentsExpanded = require_rowExpandingFeature_utils.row_getIsAllParentsExpanded;
|
|
@@ -205,6 +206,7 @@ exports.table_getRow = require_coreRowsFeature_utils.table_getRow;
|
|
|
205
206
|
exports.table_getRowCount = require_rowPaginationFeature_utils.table_getRowCount;
|
|
206
207
|
exports.table_getRowId = require_coreRowsFeature_utils.table_getRowId;
|
|
207
208
|
exports.table_getRowModel = require_coreRowModelsFeature_utils.table_getRowModel;
|
|
209
|
+
exports.table_getRowsInDisplayOrder = require_coreRowsFeature_utils.table_getRowsInDisplayOrder;
|
|
208
210
|
exports.table_getSelectedRowIds = require_rowSelectionFeature_utils.table_getSelectedRowIds;
|
|
209
211
|
exports.table_getSelectedRowModel = require_rowSelectionFeature_utils.table_getSelectedRowModel;
|
|
210
212
|
exports.table_getSortedRowModel = require_coreRowModelsFeature_utils.table_getSortedRowModel;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { cell_getContext, cell_getValue, cell_renderValue } from "./core/cells/coreCellsFeature.utils.cjs";
|
|
2
2
|
import { column_getFlatColumns, column_getLeafColumns, table_getAllColumns, table_getAllFlatColumns, table_getAllFlatColumnsById, table_getAllLeafColumns, table_getAllLeafColumnsById, table_getColumn, table_getDefaultColumnDef } from "./core/columns/coreColumnsFeature.utils.cjs";
|
|
3
3
|
import { header_getContext, header_getLeafHeaders, table_getFlatHeaders, table_getFooterGroups, table_getHeaderGroups, table_getLeafHeaders } from "./core/headers/coreHeadersFeature.utils.cjs";
|
|
4
|
-
import { row_getAllCells, row_getAllCellsByColumnId, row_getLeafRows, row_getParentRow, row_getParentRows, row_getUniqueValues, row_getValue, row_renderValue, table_getRow, table_getRowId } from "./core/rows/coreRowsFeature.utils.cjs";
|
|
4
|
+
import { row_getAllCells, row_getAllCellsByColumnId, row_getDisplayIndex, row_getLeafRows, row_getParentRow, row_getParentRows, row_getUniqueValues, row_getValue, row_renderValue, table_getRow, table_getRowId, table_getRowsInDisplayOrder } from "./core/rows/coreRowsFeature.utils.cjs";
|
|
5
5
|
import { table_getCoreRowModel, table_getExpandedRowModel, table_getFilteredRowModel, table_getGroupedRowModel, table_getPaginatedRowModel, table_getPreExpandedRowModel, table_getPreFilteredRowModel, table_getPreGroupedRowModel, table_getPrePaginatedRowModel, table_getPreSortedRowModel, table_getRowModel, table_getSortedRowModel } from "./core/row-models/coreRowModelsFeature.utils.cjs";
|
|
6
6
|
import { table_mergeOptions, table_reset, table_setOptions, table_syncExternalStateToBaseAtoms } from "./core/table/coreTablesFeature.utils.cjs";
|
|
7
7
|
import { column_getFacetedMinMaxValues, column_getFacetedRowModel, column_getFacetedUniqueValues, table_getGlobalFacetedMinMaxValues, table_getGlobalFacetedRowModel, table_getGlobalFacetedUniqueValues } from "./features/column-faceting/columnFacetingFeature.utils.cjs";
|
|
@@ -18,4 +18,4 @@ import { getDefaultPaginationState, table_autoResetPageIndex, table_firstPage, t
|
|
|
18
18
|
import { getDefaultRowPinningState, row_getCanPin, row_getIsPinned, row_getPinnedIndex, row_pin, table_getBottomRows, table_getCenterRows, table_getIsSomeRowsPinned, table_getTopRows, table_resetRowPinning, table_setRowPinning } from "./features/row-pinning/rowPinningFeature.utils.cjs";
|
|
19
19
|
import { getDefaultRowSelectionState, isRowSelected, isSubRowSelected, row_getCanMultiSelect, row_getCanSelect, row_getCanSelectSubRows, row_getIsAllSubRowsSelected, row_getIsSelected, row_getIsSomeSelected, row_getToggleSelectedHandler, row_toggleSelected, selectRowsFn, table_getFilteredSelectedRowModel, table_getGroupedSelectedRowModel, table_getIsAllPageRowsSelected, table_getIsAllRowsSelected, table_getIsSomePageRowsSelected, table_getIsSomeRowsSelected, table_getPreSelectedRowModel, table_getSelectedRowIds, table_getSelectedRowModel, table_getToggleAllPageRowsSelectedHandler, table_getToggleAllRowsSelectedHandler, table_resetRowSelection, table_setRowSelection, table_toggleAllPageRowsSelected, table_toggleAllRowsSelected } from "./features/row-selection/rowSelectionFeature.utils.cjs";
|
|
20
20
|
import { column_clearSorting, column_getAutoSortDir, column_getAutoSortFn, column_getCanMultiSort, column_getCanSort, column_getFirstSortDir, column_getIsSorted, column_getNextSortingOrder, column_getSortFn, column_getSortIndex, column_getToggleSortingHandler, column_toggleSorting, getDefaultSortingState, table_resetSorting, table_setSorting } from "./features/row-sorting/rowSortingFeature.utils.cjs";
|
|
21
|
-
export { cell_getContext, cell_getIsAggregated, cell_getIsGrouped, cell_getIsPlaceholder, cell_getValue, cell_renderValue, column_clearSorting, column_getAfter, column_getAggregationFn, column_getAutoAggregationFn, column_getAutoFilterFn, column_getAutoSortDir, column_getAutoSortFn, column_getCanFilter, column_getCanGlobalFilter, column_getCanGroup, column_getCanHide, column_getCanMultiSort, column_getCanPin, column_getCanResize, column_getCanSort, column_getFacetedMinMaxValues, column_getFacetedRowModel, column_getFacetedUniqueValues, column_getFilterFn, column_getFilterIndex, column_getFilterValue, column_getFirstSortDir, column_getFlatColumns, column_getGroupedIndex, column_getIndex, column_getIsFiltered, column_getIsFirstColumn, column_getIsGrouped, column_getIsLastColumn, column_getIsPinned, column_getIsResizing, column_getIsSorted, column_getIsVisible, column_getLeafColumns, column_getNextSortingOrder, column_getPinnedIndex, column_getSize, column_getSortFn, column_getSortIndex, column_getStart, column_getToggleGroupingHandler, column_getToggleSortingHandler, column_getToggleVisibilityHandler, column_pin, column_resetSize, column_setFilterValue, column_toggleGrouping, column_toggleSorting, column_toggleVisibility, getDefaultColumnFiltersState, getDefaultColumnOrderState, getDefaultColumnPinningState, getDefaultColumnResizingState, getDefaultColumnSizingColumnDef, getDefaultColumnSizingState, getDefaultColumnVisibilityState, getDefaultExpandedState, getDefaultGroupingState, getDefaultPaginationState, getDefaultRowPinningState, getDefaultRowSelectionState, getDefaultSortingState, header_getContext, header_getLeafHeaders, header_getResizeHandler, header_getSize, header_getStart, isRowSelected, isSubRowSelected, isTouchStartEvent, orderColumns, passiveEventSupported, row_getAllCells, row_getAllCellsByColumnId, row_getCanExpand, row_getCanMultiSelect, row_getCanPin, row_getCanSelect, row_getCanSelectSubRows, row_getCenterVisibleCells, row_getEndVisibleCells, row_getGroupingValue, row_getIsAllParentsExpanded, row_getIsAllSubRowsSelected, row_getIsExpanded, row_getIsGrouped, row_getIsPinned, row_getIsSelected, row_getIsSomeSelected, row_getLeafRows, row_getParentRow, row_getParentRows, row_getPinnedIndex, row_getStartVisibleCells, row_getToggleExpandedHandler, row_getToggleSelectedHandler, row_getUniqueValues, row_getValue, row_getVisibleCells, row_getVisibleCellsByColumnId, row_pin, row_renderValue, row_toggleExpanded, row_toggleSelected, selectRowsFn, shouldAutoRemoveFilter, table_autoResetExpanded, table_autoResetPageIndex, table_firstPage, table_getAllColumns, table_getAllFlatColumns, table_getAllFlatColumnsById, table_getAllLeafColumns, table_getAllLeafColumnsById, table_getBottomRows, table_getCanNextPage, table_getCanPreviousPage, table_getCanSomeRowsExpand, table_getCenterFlatHeaders, table_getCenterFooterGroups, table_getCenterHeaderGroups, table_getCenterLeafColumns, table_getCenterLeafHeaders, table_getCenterRows, table_getCenterTotalSize, table_getCenterVisibleLeafColumns, table_getColumn, table_getColumnIndexes, table_getColumnOffsets, table_getCoreRowModel, table_getDefaultColumnDef, table_getEndFlatHeaders, table_getEndFooterGroups, table_getEndHeaderGroups, table_getEndLeafColumns, table_getEndLeafHeaders, table_getEndTotalSize, table_getEndVisibleLeafColumns, table_getExpandedDepth, table_getExpandedRowModel, table_getFilteredRowModel, table_getFilteredSelectedRowModel, table_getFlatHeaders, table_getFooterGroups, table_getGlobalAutoFilterFn, table_getGlobalFacetedMinMaxValues, table_getGlobalFacetedRowModel, table_getGlobalFacetedUniqueValues, table_getGlobalFilterFn, table_getGroupedRowModel, table_getGroupedSelectedRowModel, table_getHeaderGroups, table_getIsAllColumnsVisible, table_getIsAllPageRowsSelected, table_getIsAllRowsExpanded, table_getIsAllRowsSelected, table_getIsSomeColumnsPinned, table_getIsSomeColumnsVisible, table_getIsSomePageRowsSelected, table_getIsSomeRowsExpanded, table_getIsSomeRowsPinned, table_getIsSomeRowsSelected, table_getLeafHeaders, table_getOrderColumnsFn, table_getPageCount, table_getPageOptions, table_getPaginatedRowModel, table_getPinnedLeafColumns, table_getPinnedVisibleLeafColumns, table_getPreExpandedRowModel, table_getPreFilteredRowModel, table_getPreGroupedRowModel, table_getPrePaginatedRowModel, table_getPreSelectedRowModel, table_getPreSortedRowModel, table_getRow, table_getRowCount, table_getRowId, table_getRowModel, table_getSelectedRowIds, table_getSelectedRowModel, table_getSortedRowModel, table_getStartFlatHeaders, table_getStartFooterGroups, table_getStartHeaderGroups, table_getStartLeafColumns, table_getStartLeafHeaders, table_getStartTotalSize, table_getStartVisibleLeafColumns, table_getToggleAllColumnsVisibilityHandler, table_getToggleAllPageRowsSelectedHandler, table_getToggleAllRowsExpandedHandler, table_getToggleAllRowsSelectedHandler, table_getTopRows, table_getTotalSize, table_getVisibleFlatColumns, table_getVisibleLeafColumns, table_lastPage, table_mergeOptions, table_nextPage, table_previousPage, table_reset, table_resetColumnFilters, table_resetColumnOrder, table_resetColumnPinning, table_resetColumnSizing, table_resetColumnVisibility, table_resetExpanded, table_resetGlobalFilter, table_resetGrouping, table_resetHeaderSizeInfo, table_resetPageIndex, table_resetPageSize, table_resetPagination, table_resetRowPinning, table_resetRowSelection, table_resetSorting, table_setColumnFilters, table_setColumnOrder, table_setColumnPinning, table_setColumnResizing, table_setColumnSizing, table_setColumnVisibility, table_setExpanded, table_setGlobalFilter, table_setGrouping, table_setOptions, table_setPageIndex, table_setPageSize, table_setPagination, table_setRowPinning, table_setRowSelection, table_setSorting, table_syncExternalStateToBaseAtoms, table_toggleAllColumnsVisible, table_toggleAllPageRowsSelected, table_toggleAllRowsExpanded, table_toggleAllRowsSelected };
|
|
21
|
+
export { cell_getContext, cell_getIsAggregated, cell_getIsGrouped, cell_getIsPlaceholder, cell_getValue, cell_renderValue, column_clearSorting, column_getAfter, column_getAggregationFn, column_getAutoAggregationFn, column_getAutoFilterFn, column_getAutoSortDir, column_getAutoSortFn, column_getCanFilter, column_getCanGlobalFilter, column_getCanGroup, column_getCanHide, column_getCanMultiSort, column_getCanPin, column_getCanResize, column_getCanSort, column_getFacetedMinMaxValues, column_getFacetedRowModel, column_getFacetedUniqueValues, column_getFilterFn, column_getFilterIndex, column_getFilterValue, column_getFirstSortDir, column_getFlatColumns, column_getGroupedIndex, column_getIndex, column_getIsFiltered, column_getIsFirstColumn, column_getIsGrouped, column_getIsLastColumn, column_getIsPinned, column_getIsResizing, column_getIsSorted, column_getIsVisible, column_getLeafColumns, column_getNextSortingOrder, column_getPinnedIndex, column_getSize, column_getSortFn, column_getSortIndex, column_getStart, column_getToggleGroupingHandler, column_getToggleSortingHandler, column_getToggleVisibilityHandler, column_pin, column_resetSize, column_setFilterValue, column_toggleGrouping, column_toggleSorting, column_toggleVisibility, getDefaultColumnFiltersState, getDefaultColumnOrderState, getDefaultColumnPinningState, getDefaultColumnResizingState, getDefaultColumnSizingColumnDef, getDefaultColumnSizingState, getDefaultColumnVisibilityState, getDefaultExpandedState, getDefaultGroupingState, getDefaultPaginationState, getDefaultRowPinningState, getDefaultRowSelectionState, getDefaultSortingState, header_getContext, header_getLeafHeaders, header_getResizeHandler, header_getSize, header_getStart, isRowSelected, isSubRowSelected, isTouchStartEvent, orderColumns, passiveEventSupported, row_getAllCells, row_getAllCellsByColumnId, row_getCanExpand, row_getCanMultiSelect, row_getCanPin, row_getCanSelect, row_getCanSelectSubRows, row_getCenterVisibleCells, row_getDisplayIndex, row_getEndVisibleCells, row_getGroupingValue, row_getIsAllParentsExpanded, row_getIsAllSubRowsSelected, row_getIsExpanded, row_getIsGrouped, row_getIsPinned, row_getIsSelected, row_getIsSomeSelected, row_getLeafRows, row_getParentRow, row_getParentRows, row_getPinnedIndex, row_getStartVisibleCells, row_getToggleExpandedHandler, row_getToggleSelectedHandler, row_getUniqueValues, row_getValue, row_getVisibleCells, row_getVisibleCellsByColumnId, row_pin, row_renderValue, row_toggleExpanded, row_toggleSelected, selectRowsFn, shouldAutoRemoveFilter, table_autoResetExpanded, table_autoResetPageIndex, table_firstPage, table_getAllColumns, table_getAllFlatColumns, table_getAllFlatColumnsById, table_getAllLeafColumns, table_getAllLeafColumnsById, table_getBottomRows, table_getCanNextPage, table_getCanPreviousPage, table_getCanSomeRowsExpand, table_getCenterFlatHeaders, table_getCenterFooterGroups, table_getCenterHeaderGroups, table_getCenterLeafColumns, table_getCenterLeafHeaders, table_getCenterRows, table_getCenterTotalSize, table_getCenterVisibleLeafColumns, table_getColumn, table_getColumnIndexes, table_getColumnOffsets, table_getCoreRowModel, table_getDefaultColumnDef, table_getEndFlatHeaders, table_getEndFooterGroups, table_getEndHeaderGroups, table_getEndLeafColumns, table_getEndLeafHeaders, table_getEndTotalSize, table_getEndVisibleLeafColumns, table_getExpandedDepth, table_getExpandedRowModel, table_getFilteredRowModel, table_getFilteredSelectedRowModel, table_getFlatHeaders, table_getFooterGroups, table_getGlobalAutoFilterFn, table_getGlobalFacetedMinMaxValues, table_getGlobalFacetedRowModel, table_getGlobalFacetedUniqueValues, table_getGlobalFilterFn, table_getGroupedRowModel, table_getGroupedSelectedRowModel, table_getHeaderGroups, table_getIsAllColumnsVisible, table_getIsAllPageRowsSelected, table_getIsAllRowsExpanded, table_getIsAllRowsSelected, table_getIsSomeColumnsPinned, table_getIsSomeColumnsVisible, table_getIsSomePageRowsSelected, table_getIsSomeRowsExpanded, table_getIsSomeRowsPinned, table_getIsSomeRowsSelected, table_getLeafHeaders, table_getOrderColumnsFn, table_getPageCount, table_getPageOptions, table_getPaginatedRowModel, table_getPinnedLeafColumns, table_getPinnedVisibleLeafColumns, table_getPreExpandedRowModel, table_getPreFilteredRowModel, table_getPreGroupedRowModel, table_getPrePaginatedRowModel, table_getPreSelectedRowModel, table_getPreSortedRowModel, table_getRow, table_getRowCount, table_getRowId, table_getRowModel, table_getRowsInDisplayOrder, table_getSelectedRowIds, table_getSelectedRowModel, table_getSortedRowModel, table_getStartFlatHeaders, table_getStartFooterGroups, table_getStartHeaderGroups, table_getStartLeafColumns, table_getStartLeafHeaders, table_getStartTotalSize, table_getStartVisibleLeafColumns, table_getToggleAllColumnsVisibilityHandler, table_getToggleAllPageRowsSelectedHandler, table_getToggleAllRowsExpandedHandler, table_getToggleAllRowsSelectedHandler, table_getTopRows, table_getTotalSize, table_getVisibleFlatColumns, table_getVisibleLeafColumns, table_lastPage, table_mergeOptions, table_nextPage, table_previousPage, table_reset, table_resetColumnFilters, table_resetColumnOrder, table_resetColumnPinning, table_resetColumnSizing, table_resetColumnVisibility, table_resetExpanded, table_resetGlobalFilter, table_resetGrouping, table_resetHeaderSizeInfo, table_resetPageIndex, table_resetPageSize, table_resetPagination, table_resetRowPinning, table_resetRowSelection, table_resetSorting, table_setColumnFilters, table_setColumnOrder, table_setColumnPinning, table_setColumnResizing, table_setColumnSizing, table_setColumnVisibility, table_setExpanded, table_setGlobalFilter, table_setGrouping, table_setOptions, table_setPageIndex, table_setPageSize, table_setPagination, table_setRowPinning, table_setRowSelection, table_setSorting, table_syncExternalStateToBaseAtoms, table_toggleAllColumnsVisible, table_toggleAllPageRowsSelected, table_toggleAllRowsExpanded, table_toggleAllRowsSelected };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { cell_getContext, cell_getValue, cell_renderValue } from "./core/cells/coreCellsFeature.utils.js";
|
|
2
2
|
import { column_getFlatColumns, column_getLeafColumns, table_getAllColumns, table_getAllFlatColumns, table_getAllFlatColumnsById, table_getAllLeafColumns, table_getAllLeafColumnsById, table_getColumn, table_getDefaultColumnDef } from "./core/columns/coreColumnsFeature.utils.js";
|
|
3
3
|
import { header_getContext, header_getLeafHeaders, table_getFlatHeaders, table_getFooterGroups, table_getHeaderGroups, table_getLeafHeaders } from "./core/headers/coreHeadersFeature.utils.js";
|
|
4
|
-
import { row_getAllCells, row_getAllCellsByColumnId, row_getLeafRows, row_getParentRow, row_getParentRows, row_getUniqueValues, row_getValue, row_renderValue, table_getRow, table_getRowId } from "./core/rows/coreRowsFeature.utils.js";
|
|
4
|
+
import { row_getAllCells, row_getAllCellsByColumnId, row_getDisplayIndex, row_getLeafRows, row_getParentRow, row_getParentRows, row_getUniqueValues, row_getValue, row_renderValue, table_getRow, table_getRowId, table_getRowsInDisplayOrder } from "./core/rows/coreRowsFeature.utils.js";
|
|
5
5
|
import { table_getCoreRowModel, table_getExpandedRowModel, table_getFilteredRowModel, table_getGroupedRowModel, table_getPaginatedRowModel, table_getPreExpandedRowModel, table_getPreFilteredRowModel, table_getPreGroupedRowModel, table_getPrePaginatedRowModel, table_getPreSortedRowModel, table_getRowModel, table_getSortedRowModel } from "./core/row-models/coreRowModelsFeature.utils.js";
|
|
6
6
|
import { table_mergeOptions, table_reset, table_setOptions, table_syncExternalStateToBaseAtoms } from "./core/table/coreTablesFeature.utils.js";
|
|
7
7
|
import { column_getFacetedMinMaxValues, column_getFacetedRowModel, column_getFacetedUniqueValues, table_getGlobalFacetedMinMaxValues, table_getGlobalFacetedRowModel, table_getGlobalFacetedUniqueValues } from "./features/column-faceting/columnFacetingFeature.utils.js";
|
|
@@ -18,4 +18,4 @@ import { getDefaultPaginationState, table_autoResetPageIndex, table_firstPage, t
|
|
|
18
18
|
import { getDefaultRowPinningState, row_getCanPin, row_getIsPinned, row_getPinnedIndex, row_pin, table_getBottomRows, table_getCenterRows, table_getIsSomeRowsPinned, table_getTopRows, table_resetRowPinning, table_setRowPinning } from "./features/row-pinning/rowPinningFeature.utils.js";
|
|
19
19
|
import { getDefaultRowSelectionState, isRowSelected, isSubRowSelected, row_getCanMultiSelect, row_getCanSelect, row_getCanSelectSubRows, row_getIsAllSubRowsSelected, row_getIsSelected, row_getIsSomeSelected, row_getToggleSelectedHandler, row_toggleSelected, selectRowsFn, table_getFilteredSelectedRowModel, table_getGroupedSelectedRowModel, table_getIsAllPageRowsSelected, table_getIsAllRowsSelected, table_getIsSomePageRowsSelected, table_getIsSomeRowsSelected, table_getPreSelectedRowModel, table_getSelectedRowIds, table_getSelectedRowModel, table_getToggleAllPageRowsSelectedHandler, table_getToggleAllRowsSelectedHandler, table_resetRowSelection, table_setRowSelection, table_toggleAllPageRowsSelected, table_toggleAllRowsSelected } from "./features/row-selection/rowSelectionFeature.utils.js";
|
|
20
20
|
import { column_clearSorting, column_getAutoSortDir, column_getAutoSortFn, column_getCanMultiSort, column_getCanSort, column_getFirstSortDir, column_getIsSorted, column_getNextSortingOrder, column_getSortFn, column_getSortIndex, column_getToggleSortingHandler, column_toggleSorting, getDefaultSortingState, table_resetSorting, table_setSorting } from "./features/row-sorting/rowSortingFeature.utils.js";
|
|
21
|
-
export { cell_getContext, cell_getIsAggregated, cell_getIsGrouped, cell_getIsPlaceholder, cell_getValue, cell_renderValue, column_clearSorting, column_getAfter, column_getAggregationFn, column_getAutoAggregationFn, column_getAutoFilterFn, column_getAutoSortDir, column_getAutoSortFn, column_getCanFilter, column_getCanGlobalFilter, column_getCanGroup, column_getCanHide, column_getCanMultiSort, column_getCanPin, column_getCanResize, column_getCanSort, column_getFacetedMinMaxValues, column_getFacetedRowModel, column_getFacetedUniqueValues, column_getFilterFn, column_getFilterIndex, column_getFilterValue, column_getFirstSortDir, column_getFlatColumns, column_getGroupedIndex, column_getIndex, column_getIsFiltered, column_getIsFirstColumn, column_getIsGrouped, column_getIsLastColumn, column_getIsPinned, column_getIsResizing, column_getIsSorted, column_getIsVisible, column_getLeafColumns, column_getNextSortingOrder, column_getPinnedIndex, column_getSize, column_getSortFn, column_getSortIndex, column_getStart, column_getToggleGroupingHandler, column_getToggleSortingHandler, column_getToggleVisibilityHandler, column_pin, column_resetSize, column_setFilterValue, column_toggleGrouping, column_toggleSorting, column_toggleVisibility, getDefaultColumnFiltersState, getDefaultColumnOrderState, getDefaultColumnPinningState, getDefaultColumnResizingState, getDefaultColumnSizingColumnDef, getDefaultColumnSizingState, getDefaultColumnVisibilityState, getDefaultExpandedState, getDefaultGroupingState, getDefaultPaginationState, getDefaultRowPinningState, getDefaultRowSelectionState, getDefaultSortingState, header_getContext, header_getLeafHeaders, header_getResizeHandler, header_getSize, header_getStart, isRowSelected, isSubRowSelected, isTouchStartEvent, orderColumns, passiveEventSupported, row_getAllCells, row_getAllCellsByColumnId, row_getCanExpand, row_getCanMultiSelect, row_getCanPin, row_getCanSelect, row_getCanSelectSubRows, row_getCenterVisibleCells, row_getEndVisibleCells, row_getGroupingValue, row_getIsAllParentsExpanded, row_getIsAllSubRowsSelected, row_getIsExpanded, row_getIsGrouped, row_getIsPinned, row_getIsSelected, row_getIsSomeSelected, row_getLeafRows, row_getParentRow, row_getParentRows, row_getPinnedIndex, row_getStartVisibleCells, row_getToggleExpandedHandler, row_getToggleSelectedHandler, row_getUniqueValues, row_getValue, row_getVisibleCells, row_getVisibleCellsByColumnId, row_pin, row_renderValue, row_toggleExpanded, row_toggleSelected, selectRowsFn, shouldAutoRemoveFilter, table_autoResetExpanded, table_autoResetPageIndex, table_firstPage, table_getAllColumns, table_getAllFlatColumns, table_getAllFlatColumnsById, table_getAllLeafColumns, table_getAllLeafColumnsById, table_getBottomRows, table_getCanNextPage, table_getCanPreviousPage, table_getCanSomeRowsExpand, table_getCenterFlatHeaders, table_getCenterFooterGroups, table_getCenterHeaderGroups, table_getCenterLeafColumns, table_getCenterLeafHeaders, table_getCenterRows, table_getCenterTotalSize, table_getCenterVisibleLeafColumns, table_getColumn, table_getColumnIndexes, table_getColumnOffsets, table_getCoreRowModel, table_getDefaultColumnDef, table_getEndFlatHeaders, table_getEndFooterGroups, table_getEndHeaderGroups, table_getEndLeafColumns, table_getEndLeafHeaders, table_getEndTotalSize, table_getEndVisibleLeafColumns, table_getExpandedDepth, table_getExpandedRowModel, table_getFilteredRowModel, table_getFilteredSelectedRowModel, table_getFlatHeaders, table_getFooterGroups, table_getGlobalAutoFilterFn, table_getGlobalFacetedMinMaxValues, table_getGlobalFacetedRowModel, table_getGlobalFacetedUniqueValues, table_getGlobalFilterFn, table_getGroupedRowModel, table_getGroupedSelectedRowModel, table_getHeaderGroups, table_getIsAllColumnsVisible, table_getIsAllPageRowsSelected, table_getIsAllRowsExpanded, table_getIsAllRowsSelected, table_getIsSomeColumnsPinned, table_getIsSomeColumnsVisible, table_getIsSomePageRowsSelected, table_getIsSomeRowsExpanded, table_getIsSomeRowsPinned, table_getIsSomeRowsSelected, table_getLeafHeaders, table_getOrderColumnsFn, table_getPageCount, table_getPageOptions, table_getPaginatedRowModel, table_getPinnedLeafColumns, table_getPinnedVisibleLeafColumns, table_getPreExpandedRowModel, table_getPreFilteredRowModel, table_getPreGroupedRowModel, table_getPrePaginatedRowModel, table_getPreSelectedRowModel, table_getPreSortedRowModel, table_getRow, table_getRowCount, table_getRowId, table_getRowModel, table_getSelectedRowIds, table_getSelectedRowModel, table_getSortedRowModel, table_getStartFlatHeaders, table_getStartFooterGroups, table_getStartHeaderGroups, table_getStartLeafColumns, table_getStartLeafHeaders, table_getStartTotalSize, table_getStartVisibleLeafColumns, table_getToggleAllColumnsVisibilityHandler, table_getToggleAllPageRowsSelectedHandler, table_getToggleAllRowsExpandedHandler, table_getToggleAllRowsSelectedHandler, table_getTopRows, table_getTotalSize, table_getVisibleFlatColumns, table_getVisibleLeafColumns, table_lastPage, table_mergeOptions, table_nextPage, table_previousPage, table_reset, table_resetColumnFilters, table_resetColumnOrder, table_resetColumnPinning, table_resetColumnSizing, table_resetColumnVisibility, table_resetExpanded, table_resetGlobalFilter, table_resetGrouping, table_resetHeaderSizeInfo, table_resetPageIndex, table_resetPageSize, table_resetPagination, table_resetRowPinning, table_resetRowSelection, table_resetSorting, table_setColumnFilters, table_setColumnOrder, table_setColumnPinning, table_setColumnResizing, table_setColumnSizing, table_setColumnVisibility, table_setExpanded, table_setGlobalFilter, table_setGrouping, table_setOptions, table_setPageIndex, table_setPageSize, table_setPagination, table_setRowPinning, table_setRowSelection, table_setSorting, table_syncExternalStateToBaseAtoms, table_toggleAllColumnsVisible, table_toggleAllPageRowsSelected, table_toggleAllRowsExpanded, table_toggleAllRowsSelected };
|
|
21
|
+
export { cell_getContext, cell_getIsAggregated, cell_getIsGrouped, cell_getIsPlaceholder, cell_getValue, cell_renderValue, column_clearSorting, column_getAfter, column_getAggregationFn, column_getAutoAggregationFn, column_getAutoFilterFn, column_getAutoSortDir, column_getAutoSortFn, column_getCanFilter, column_getCanGlobalFilter, column_getCanGroup, column_getCanHide, column_getCanMultiSort, column_getCanPin, column_getCanResize, column_getCanSort, column_getFacetedMinMaxValues, column_getFacetedRowModel, column_getFacetedUniqueValues, column_getFilterFn, column_getFilterIndex, column_getFilterValue, column_getFirstSortDir, column_getFlatColumns, column_getGroupedIndex, column_getIndex, column_getIsFiltered, column_getIsFirstColumn, column_getIsGrouped, column_getIsLastColumn, column_getIsPinned, column_getIsResizing, column_getIsSorted, column_getIsVisible, column_getLeafColumns, column_getNextSortingOrder, column_getPinnedIndex, column_getSize, column_getSortFn, column_getSortIndex, column_getStart, column_getToggleGroupingHandler, column_getToggleSortingHandler, column_getToggleVisibilityHandler, column_pin, column_resetSize, column_setFilterValue, column_toggleGrouping, column_toggleSorting, column_toggleVisibility, getDefaultColumnFiltersState, getDefaultColumnOrderState, getDefaultColumnPinningState, getDefaultColumnResizingState, getDefaultColumnSizingColumnDef, getDefaultColumnSizingState, getDefaultColumnVisibilityState, getDefaultExpandedState, getDefaultGroupingState, getDefaultPaginationState, getDefaultRowPinningState, getDefaultRowSelectionState, getDefaultSortingState, header_getContext, header_getLeafHeaders, header_getResizeHandler, header_getSize, header_getStart, isRowSelected, isSubRowSelected, isTouchStartEvent, orderColumns, passiveEventSupported, row_getAllCells, row_getAllCellsByColumnId, row_getCanExpand, row_getCanMultiSelect, row_getCanPin, row_getCanSelect, row_getCanSelectSubRows, row_getCenterVisibleCells, row_getDisplayIndex, row_getEndVisibleCells, row_getGroupingValue, row_getIsAllParentsExpanded, row_getIsAllSubRowsSelected, row_getIsExpanded, row_getIsGrouped, row_getIsPinned, row_getIsSelected, row_getIsSomeSelected, row_getLeafRows, row_getParentRow, row_getParentRows, row_getPinnedIndex, row_getStartVisibleCells, row_getToggleExpandedHandler, row_getToggleSelectedHandler, row_getUniqueValues, row_getValue, row_getVisibleCells, row_getVisibleCellsByColumnId, row_pin, row_renderValue, row_toggleExpanded, row_toggleSelected, selectRowsFn, shouldAutoRemoveFilter, table_autoResetExpanded, table_autoResetPageIndex, table_firstPage, table_getAllColumns, table_getAllFlatColumns, table_getAllFlatColumnsById, table_getAllLeafColumns, table_getAllLeafColumnsById, table_getBottomRows, table_getCanNextPage, table_getCanPreviousPage, table_getCanSomeRowsExpand, table_getCenterFlatHeaders, table_getCenterFooterGroups, table_getCenterHeaderGroups, table_getCenterLeafColumns, table_getCenterLeafHeaders, table_getCenterRows, table_getCenterTotalSize, table_getCenterVisibleLeafColumns, table_getColumn, table_getColumnIndexes, table_getColumnOffsets, table_getCoreRowModel, table_getDefaultColumnDef, table_getEndFlatHeaders, table_getEndFooterGroups, table_getEndHeaderGroups, table_getEndLeafColumns, table_getEndLeafHeaders, table_getEndTotalSize, table_getEndVisibleLeafColumns, table_getExpandedDepth, table_getExpandedRowModel, table_getFilteredRowModel, table_getFilteredSelectedRowModel, table_getFlatHeaders, table_getFooterGroups, table_getGlobalAutoFilterFn, table_getGlobalFacetedMinMaxValues, table_getGlobalFacetedRowModel, table_getGlobalFacetedUniqueValues, table_getGlobalFilterFn, table_getGroupedRowModel, table_getGroupedSelectedRowModel, table_getHeaderGroups, table_getIsAllColumnsVisible, table_getIsAllPageRowsSelected, table_getIsAllRowsExpanded, table_getIsAllRowsSelected, table_getIsSomeColumnsPinned, table_getIsSomeColumnsVisible, table_getIsSomePageRowsSelected, table_getIsSomeRowsExpanded, table_getIsSomeRowsPinned, table_getIsSomeRowsSelected, table_getLeafHeaders, table_getOrderColumnsFn, table_getPageCount, table_getPageOptions, table_getPaginatedRowModel, table_getPinnedLeafColumns, table_getPinnedVisibleLeafColumns, table_getPreExpandedRowModel, table_getPreFilteredRowModel, table_getPreGroupedRowModel, table_getPrePaginatedRowModel, table_getPreSelectedRowModel, table_getPreSortedRowModel, table_getRow, table_getRowCount, table_getRowId, table_getRowModel, table_getRowsInDisplayOrder, table_getSelectedRowIds, table_getSelectedRowModel, table_getSortedRowModel, table_getStartFlatHeaders, table_getStartFooterGroups, table_getStartHeaderGroups, table_getStartLeafColumns, table_getStartLeafHeaders, table_getStartTotalSize, table_getStartVisibleLeafColumns, table_getToggleAllColumnsVisibilityHandler, table_getToggleAllPageRowsSelectedHandler, table_getToggleAllRowsExpandedHandler, table_getToggleAllRowsSelectedHandler, table_getTopRows, table_getTotalSize, table_getVisibleFlatColumns, table_getVisibleLeafColumns, table_lastPage, table_mergeOptions, table_nextPage, table_previousPage, table_reset, table_resetColumnFilters, table_resetColumnOrder, table_resetColumnPinning, table_resetColumnSizing, table_resetColumnVisibility, table_resetExpanded, table_resetGlobalFilter, table_resetGrouping, table_resetHeaderSizeInfo, table_resetPageIndex, table_resetPageSize, table_resetPagination, table_resetRowPinning, table_resetRowSelection, table_resetSorting, table_setColumnFilters, table_setColumnOrder, table_setColumnPinning, table_setColumnResizing, table_setColumnSizing, table_setColumnVisibility, table_setExpanded, table_setGlobalFilter, table_setGrouping, table_setOptions, table_setPageIndex, table_setPageSize, table_setPagination, table_setRowPinning, table_setRowSelection, table_setSorting, table_syncExternalStateToBaseAtoms, table_toggleAllColumnsVisible, table_toggleAllPageRowsSelected, table_toggleAllRowsExpanded, table_toggleAllRowsSelected };
|
package/dist/static-functions.js
CHANGED
|
@@ -6,7 +6,7 @@ import { column_getFlatColumns, column_getLeafColumns, table_getAllColumns, tabl
|
|
|
6
6
|
import { header_getContext, header_getLeafHeaders, table_getFlatHeaders, table_getFooterGroups, table_getHeaderGroups, table_getLeafHeaders } from "./core/headers/coreHeadersFeature.utils.js";
|
|
7
7
|
import { getDefaultPaginationState, table_autoResetPageIndex, table_firstPage, table_getCanNextPage, table_getCanPreviousPage, table_getPageCount, table_getPageOptions, table_getRowCount, table_lastPage, table_nextPage, table_previousPage, table_resetPageIndex, table_resetPageSize, table_resetPagination, table_setPageIndex, table_setPageSize, table_setPagination } from "./features/row-pagination/rowPaginationFeature.utils.js";
|
|
8
8
|
import { table_getCoreRowModel, table_getExpandedRowModel, table_getFilteredRowModel, table_getGroupedRowModel, table_getPaginatedRowModel, table_getPreExpandedRowModel, table_getPreFilteredRowModel, table_getPreGroupedRowModel, table_getPrePaginatedRowModel, table_getPreSortedRowModel, table_getRowModel, table_getSortedRowModel } from "./core/row-models/coreRowModelsFeature.utils.js";
|
|
9
|
-
import { row_getAllCells, row_getAllCellsByColumnId, row_getLeafRows, row_getParentRow, row_getParentRows, row_getUniqueValues, row_getValue, row_renderValue, table_getRow, table_getRowId } from "./core/rows/coreRowsFeature.utils.js";
|
|
9
|
+
import { row_getAllCells, row_getAllCellsByColumnId, row_getDisplayIndex, row_getLeafRows, row_getParentRow, row_getParentRows, row_getUniqueValues, row_getValue, row_renderValue, table_getRow, table_getRowId, table_getRowsInDisplayOrder } from "./core/rows/coreRowsFeature.utils.js";
|
|
10
10
|
import { table_mergeOptions, table_reset, table_setOptions, table_syncExternalStateToBaseAtoms } from "./core/table/coreTablesFeature.utils.js";
|
|
11
11
|
import { column_getFacetedMinMaxValues, column_getFacetedRowModel, column_getFacetedUniqueValues, table_getGlobalFacetedMinMaxValues, table_getGlobalFacetedRowModel, table_getGlobalFacetedUniqueValues } from "./features/column-faceting/columnFacetingFeature.utils.js";
|
|
12
12
|
import { column_getAutoFilterFn, column_getCanFilter, column_getFilterFn, column_getFilterIndex, column_getFilterValue, column_getIsFiltered, column_setFilterValue, getDefaultColumnFiltersState, shouldAutoRemoveFilter, table_resetColumnFilters, table_setColumnFilters } from "./features/column-filtering/columnFilteringFeature.utils.js";
|
|
@@ -19,4 +19,4 @@ import { getDefaultRowPinningState, row_getCanPin, row_getIsPinned, row_getPinne
|
|
|
19
19
|
import { getDefaultRowSelectionState, isRowSelected, isSubRowSelected, row_getCanMultiSelect, row_getCanSelect, row_getCanSelectSubRows, row_getIsAllSubRowsSelected, row_getIsSelected, row_getIsSomeSelected, row_getToggleSelectedHandler, row_toggleSelected, selectRowsFn, table_getFilteredSelectedRowModel, table_getGroupedSelectedRowModel, table_getIsAllPageRowsSelected, table_getIsAllRowsSelected, table_getIsSomePageRowsSelected, table_getIsSomeRowsSelected, table_getPreSelectedRowModel, table_getSelectedRowIds, table_getSelectedRowModel, table_getToggleAllPageRowsSelectedHandler, table_getToggleAllRowsSelectedHandler, table_resetRowSelection, table_setRowSelection, table_toggleAllPageRowsSelected, table_toggleAllRowsSelected } from "./features/row-selection/rowSelectionFeature.utils.js";
|
|
20
20
|
import { column_clearSorting, column_getAutoSortDir, column_getAutoSortFn, column_getCanMultiSort, column_getCanSort, column_getFirstSortDir, column_getIsSorted, column_getNextSortingOrder, column_getSortFn, column_getSortIndex, column_getToggleSortingHandler, column_toggleSorting, getDefaultSortingState, table_resetSorting, table_setSorting } from "./features/row-sorting/rowSortingFeature.utils.js";
|
|
21
21
|
|
|
22
|
-
export { cell_getContext, cell_getIsAggregated, cell_getIsGrouped, cell_getIsPlaceholder, cell_getValue, cell_renderValue, column_clearSorting, column_getAfter, column_getAggregationFn, column_getAutoAggregationFn, column_getAutoFilterFn, column_getAutoSortDir, column_getAutoSortFn, column_getCanFilter, column_getCanGlobalFilter, column_getCanGroup, column_getCanHide, column_getCanMultiSort, column_getCanPin, column_getCanResize, column_getCanSort, column_getFacetedMinMaxValues, column_getFacetedRowModel, column_getFacetedUniqueValues, column_getFilterFn, column_getFilterIndex, column_getFilterValue, column_getFirstSortDir, column_getFlatColumns, column_getGroupedIndex, column_getIndex, column_getIsFiltered, column_getIsFirstColumn, column_getIsGrouped, column_getIsLastColumn, column_getIsPinned, column_getIsResizing, column_getIsSorted, column_getIsVisible, column_getLeafColumns, column_getNextSortingOrder, column_getPinnedIndex, column_getSize, column_getSortFn, column_getSortIndex, column_getStart, column_getToggleGroupingHandler, column_getToggleSortingHandler, column_getToggleVisibilityHandler, column_pin, column_resetSize, column_setFilterValue, column_toggleGrouping, column_toggleSorting, column_toggleVisibility, getDefaultColumnFiltersState, getDefaultColumnOrderState, getDefaultColumnPinningState, getDefaultColumnResizingState, getDefaultColumnSizingColumnDef, getDefaultColumnSizingState, getDefaultColumnVisibilityState, getDefaultExpandedState, getDefaultGroupingState, getDefaultPaginationState, getDefaultRowPinningState, getDefaultRowSelectionState, getDefaultSortingState, header_getContext, header_getLeafHeaders, header_getResizeHandler, header_getSize, header_getStart, isRowSelected, isSubRowSelected, isTouchStartEvent, orderColumns, passiveEventSupported, row_getAllCells, row_getAllCellsByColumnId, row_getCanExpand, row_getCanMultiSelect, row_getCanPin, row_getCanSelect, row_getCanSelectSubRows, row_getCenterVisibleCells, row_getEndVisibleCells, row_getGroupingValue, row_getIsAllParentsExpanded, row_getIsAllSubRowsSelected, row_getIsExpanded, row_getIsGrouped, row_getIsPinned, row_getIsSelected, row_getIsSomeSelected, row_getLeafRows, row_getParentRow, row_getParentRows, row_getPinnedIndex, row_getStartVisibleCells, row_getToggleExpandedHandler, row_getToggleSelectedHandler, row_getUniqueValues, row_getValue, row_getVisibleCells, row_getVisibleCellsByColumnId, row_pin, row_renderValue, row_toggleExpanded, row_toggleSelected, selectRowsFn, shouldAutoRemoveFilter, table_autoResetExpanded, table_autoResetPageIndex, table_firstPage, table_getAllColumns, table_getAllFlatColumns, table_getAllFlatColumnsById, table_getAllLeafColumns, table_getAllLeafColumnsById, table_getBottomRows, table_getCanNextPage, table_getCanPreviousPage, table_getCanSomeRowsExpand, table_getCenterFlatHeaders, table_getCenterFooterGroups, table_getCenterHeaderGroups, table_getCenterLeafColumns, table_getCenterLeafHeaders, table_getCenterRows, table_getCenterTotalSize, table_getCenterVisibleLeafColumns, table_getColumn, table_getColumnIndexes, table_getColumnOffsets, table_getCoreRowModel, table_getDefaultColumnDef, table_getEndFlatHeaders, table_getEndFooterGroups, table_getEndHeaderGroups, table_getEndLeafColumns, table_getEndLeafHeaders, table_getEndTotalSize, table_getEndVisibleLeafColumns, table_getExpandedDepth, table_getExpandedRowModel, table_getFilteredRowModel, table_getFilteredSelectedRowModel, table_getFlatHeaders, table_getFooterGroups, table_getGlobalAutoFilterFn, table_getGlobalFacetedMinMaxValues, table_getGlobalFacetedRowModel, table_getGlobalFacetedUniqueValues, table_getGlobalFilterFn, table_getGroupedRowModel, table_getGroupedSelectedRowModel, table_getHeaderGroups, table_getIsAllColumnsVisible, table_getIsAllPageRowsSelected, table_getIsAllRowsExpanded, table_getIsAllRowsSelected, table_getIsSomeColumnsPinned, table_getIsSomeColumnsVisible, table_getIsSomePageRowsSelected, table_getIsSomeRowsExpanded, table_getIsSomeRowsPinned, table_getIsSomeRowsSelected, table_getLeafHeaders, table_getOrderColumnsFn, table_getPageCount, table_getPageOptions, table_getPaginatedRowModel, table_getPinnedLeafColumns, table_getPinnedVisibleLeafColumns, table_getPreExpandedRowModel, table_getPreFilteredRowModel, table_getPreGroupedRowModel, table_getPrePaginatedRowModel, table_getPreSelectedRowModel, table_getPreSortedRowModel, table_getRow, table_getRowCount, table_getRowId, table_getRowModel, table_getSelectedRowIds, table_getSelectedRowModel, table_getSortedRowModel, table_getStartFlatHeaders, table_getStartFooterGroups, table_getStartHeaderGroups, table_getStartLeafColumns, table_getStartLeafHeaders, table_getStartTotalSize, table_getStartVisibleLeafColumns, table_getToggleAllColumnsVisibilityHandler, table_getToggleAllPageRowsSelectedHandler, table_getToggleAllRowsExpandedHandler, table_getToggleAllRowsSelectedHandler, table_getTopRows, table_getTotalSize, table_getVisibleFlatColumns, table_getVisibleLeafColumns, table_lastPage, table_mergeOptions, table_nextPage, table_previousPage, table_reset, table_resetColumnFilters, table_resetColumnOrder, table_resetColumnPinning, table_resetColumnSizing, table_resetColumnVisibility, table_resetExpanded, table_resetGlobalFilter, table_resetGrouping, table_resetHeaderSizeInfo, table_resetPageIndex, table_resetPageSize, table_resetPagination, table_resetRowPinning, table_resetRowSelection, table_resetSorting, table_setColumnFilters, table_setColumnOrder, table_setColumnPinning, table_setColumnResizing, table_setColumnSizing, table_setColumnVisibility, table_setExpanded, table_setGlobalFilter, table_setGrouping, table_setOptions, table_setPageIndex, table_setPageSize, table_setPagination, table_setRowPinning, table_setRowSelection, table_setSorting, table_syncExternalStateToBaseAtoms, table_toggleAllColumnsVisible, table_toggleAllPageRowsSelected, table_toggleAllRowsExpanded, table_toggleAllRowsSelected };
|
|
22
|
+
export { cell_getContext, cell_getIsAggregated, cell_getIsGrouped, cell_getIsPlaceholder, cell_getValue, cell_renderValue, column_clearSorting, column_getAfter, column_getAggregationFn, column_getAutoAggregationFn, column_getAutoFilterFn, column_getAutoSortDir, column_getAutoSortFn, column_getCanFilter, column_getCanGlobalFilter, column_getCanGroup, column_getCanHide, column_getCanMultiSort, column_getCanPin, column_getCanResize, column_getCanSort, column_getFacetedMinMaxValues, column_getFacetedRowModel, column_getFacetedUniqueValues, column_getFilterFn, column_getFilterIndex, column_getFilterValue, column_getFirstSortDir, column_getFlatColumns, column_getGroupedIndex, column_getIndex, column_getIsFiltered, column_getIsFirstColumn, column_getIsGrouped, column_getIsLastColumn, column_getIsPinned, column_getIsResizing, column_getIsSorted, column_getIsVisible, column_getLeafColumns, column_getNextSortingOrder, column_getPinnedIndex, column_getSize, column_getSortFn, column_getSortIndex, column_getStart, column_getToggleGroupingHandler, column_getToggleSortingHandler, column_getToggleVisibilityHandler, column_pin, column_resetSize, column_setFilterValue, column_toggleGrouping, column_toggleSorting, column_toggleVisibility, getDefaultColumnFiltersState, getDefaultColumnOrderState, getDefaultColumnPinningState, getDefaultColumnResizingState, getDefaultColumnSizingColumnDef, getDefaultColumnSizingState, getDefaultColumnVisibilityState, getDefaultExpandedState, getDefaultGroupingState, getDefaultPaginationState, getDefaultRowPinningState, getDefaultRowSelectionState, getDefaultSortingState, header_getContext, header_getLeafHeaders, header_getResizeHandler, header_getSize, header_getStart, isRowSelected, isSubRowSelected, isTouchStartEvent, orderColumns, passiveEventSupported, row_getAllCells, row_getAllCellsByColumnId, row_getCanExpand, row_getCanMultiSelect, row_getCanPin, row_getCanSelect, row_getCanSelectSubRows, row_getCenterVisibleCells, row_getDisplayIndex, row_getEndVisibleCells, row_getGroupingValue, row_getIsAllParentsExpanded, row_getIsAllSubRowsSelected, row_getIsExpanded, row_getIsGrouped, row_getIsPinned, row_getIsSelected, row_getIsSomeSelected, row_getLeafRows, row_getParentRow, row_getParentRows, row_getPinnedIndex, row_getStartVisibleCells, row_getToggleExpandedHandler, row_getToggleSelectedHandler, row_getUniqueValues, row_getValue, row_getVisibleCells, row_getVisibleCellsByColumnId, row_pin, row_renderValue, row_toggleExpanded, row_toggleSelected, selectRowsFn, shouldAutoRemoveFilter, table_autoResetExpanded, table_autoResetPageIndex, table_firstPage, table_getAllColumns, table_getAllFlatColumns, table_getAllFlatColumnsById, table_getAllLeafColumns, table_getAllLeafColumnsById, table_getBottomRows, table_getCanNextPage, table_getCanPreviousPage, table_getCanSomeRowsExpand, table_getCenterFlatHeaders, table_getCenterFooterGroups, table_getCenterHeaderGroups, table_getCenterLeafColumns, table_getCenterLeafHeaders, table_getCenterRows, table_getCenterTotalSize, table_getCenterVisibleLeafColumns, table_getColumn, table_getColumnIndexes, table_getColumnOffsets, table_getCoreRowModel, table_getDefaultColumnDef, table_getEndFlatHeaders, table_getEndFooterGroups, table_getEndHeaderGroups, table_getEndLeafColumns, table_getEndLeafHeaders, table_getEndTotalSize, table_getEndVisibleLeafColumns, table_getExpandedDepth, table_getExpandedRowModel, table_getFilteredRowModel, table_getFilteredSelectedRowModel, table_getFlatHeaders, table_getFooterGroups, table_getGlobalAutoFilterFn, table_getGlobalFacetedMinMaxValues, table_getGlobalFacetedRowModel, table_getGlobalFacetedUniqueValues, table_getGlobalFilterFn, table_getGroupedRowModel, table_getGroupedSelectedRowModel, table_getHeaderGroups, table_getIsAllColumnsVisible, table_getIsAllPageRowsSelected, table_getIsAllRowsExpanded, table_getIsAllRowsSelected, table_getIsSomeColumnsPinned, table_getIsSomeColumnsVisible, table_getIsSomePageRowsSelected, table_getIsSomeRowsExpanded, table_getIsSomeRowsPinned, table_getIsSomeRowsSelected, table_getLeafHeaders, table_getOrderColumnsFn, table_getPageCount, table_getPageOptions, table_getPaginatedRowModel, table_getPinnedLeafColumns, table_getPinnedVisibleLeafColumns, table_getPreExpandedRowModel, table_getPreFilteredRowModel, table_getPreGroupedRowModel, table_getPrePaginatedRowModel, table_getPreSelectedRowModel, table_getPreSortedRowModel, table_getRow, table_getRowCount, table_getRowId, table_getRowModel, table_getRowsInDisplayOrder, table_getSelectedRowIds, table_getSelectedRowModel, table_getSortedRowModel, table_getStartFlatHeaders, table_getStartFooterGroups, table_getStartHeaderGroups, table_getStartLeafColumns, table_getStartLeafHeaders, table_getStartTotalSize, table_getStartVisibleLeafColumns, table_getToggleAllColumnsVisibilityHandler, table_getToggleAllPageRowsSelectedHandler, table_getToggleAllRowsExpandedHandler, table_getToggleAllRowsSelectedHandler, table_getTopRows, table_getTotalSize, table_getVisibleFlatColumns, table_getVisibleLeafColumns, table_lastPage, table_mergeOptions, table_nextPage, table_previousPage, table_reset, table_resetColumnFilters, table_resetColumnOrder, table_resetColumnPinning, table_resetColumnSizing, table_resetColumnVisibility, table_resetExpanded, table_resetGlobalFilter, table_resetGrouping, table_resetHeaderSizeInfo, table_resetPageIndex, table_resetPageSize, table_resetPagination, table_resetRowPinning, table_resetRowSelection, table_resetSorting, table_setColumnFilters, table_setColumnOrder, table_setColumnPinning, table_setColumnResizing, table_setColumnSizing, table_setColumnVisibility, table_setExpanded, table_setGlobalFilter, table_setGrouping, table_setOptions, table_setPageIndex, table_setPageSize, table_setPagination, table_setRowPinning, table_setRowSelection, table_setSorting, table_syncExternalStateToBaseAtoms, table_toggleAllColumnsVisible, table_toggleAllPageRowsSelected, table_toggleAllRowsExpanded, table_toggleAllRowsSelected };
|
package/package.json
CHANGED
package/skills/core/SKILL.md
CHANGED
|
@@ -5,7 +5,7 @@ description: >
|
|
|
5
5
|
metadata:
|
|
6
6
|
type: sub-skill
|
|
7
7
|
library: '@tanstack/table-core'
|
|
8
|
-
library_version: '9.0.0-beta.
|
|
8
|
+
library_version: '9.0.0-beta.43'
|
|
9
9
|
requires: ['core', 'table-features', 'typescript']
|
|
10
10
|
sources:
|
|
11
11
|
- 'TanStack/table:docs/framework/react/guide/custom-features.md'
|
package/skills/grouping/SKILL.md
CHANGED
|
@@ -5,7 +5,7 @@ description: >
|
|
|
5
5
|
metadata:
|
|
6
6
|
type: lifecycle
|
|
7
7
|
library: '@tanstack/table-core'
|
|
8
|
-
library_version: '9.0.0-beta.
|
|
8
|
+
library_version: '9.0.0-beta.43'
|
|
9
9
|
requires: ['core', 'table-features', 'typescript']
|
|
10
10
|
sources:
|
|
11
11
|
- 'TanStack/table:docs/framework/react/guide/migrating.md'
|
package/skills/sorting/SKILL.md
CHANGED
|
@@ -2,6 +2,7 @@ import { assignPrototypeAPIs, assignTableAPIs } from '../../utils'
|
|
|
2
2
|
import {
|
|
3
3
|
row_getAllCells,
|
|
4
4
|
row_getAllCellsByColumnId,
|
|
5
|
+
row_getDisplayIndex,
|
|
5
6
|
row_getLeafRows,
|
|
6
7
|
row_getParentRow,
|
|
7
8
|
row_getParentRows,
|
|
@@ -10,6 +11,7 @@ import {
|
|
|
10
11
|
row_renderValue,
|
|
11
12
|
table_getRow,
|
|
12
13
|
table_getRowId,
|
|
14
|
+
table_getRowsInDisplayOrder,
|
|
13
15
|
} from './coreRowsFeature.utils'
|
|
14
16
|
import type { TableFeature } from '../../types/TableFeatures'
|
|
15
17
|
|
|
@@ -19,6 +21,9 @@ import type { TableFeature } from '../../types/TableFeatures'
|
|
|
19
21
|
export const coreRowsFeature: TableFeature = {
|
|
20
22
|
assignRowPrototype: (prototype, table) => {
|
|
21
23
|
assignPrototypeAPIs('coreRowsFeature', prototype, table, {
|
|
24
|
+
row_getDisplayIndex: {
|
|
25
|
+
fn: (row) => row_getDisplayIndex(row),
|
|
26
|
+
},
|
|
22
27
|
row_getAllCellsByColumnId: {
|
|
23
28
|
fn: (row) => row_getAllCellsByColumnId(row),
|
|
24
29
|
memoDeps: (row) => [row.getAllCells()],
|
|
@@ -50,6 +55,16 @@ export const coreRowsFeature: TableFeature = {
|
|
|
50
55
|
},
|
|
51
56
|
constructTableAPIs: (table) => {
|
|
52
57
|
assignTableAPIs('coreRowsFeature', table, {
|
|
58
|
+
table_getRowsInDisplayOrder: {
|
|
59
|
+
fn: () => table_getRowsInDisplayOrder(table),
|
|
60
|
+
memoDeps: () => [
|
|
61
|
+
table.getPrePaginatedRowModel().rows,
|
|
62
|
+
table.options.paginateExpandedRows,
|
|
63
|
+
table.options.paginateExpandedRows === false
|
|
64
|
+
? table.atoms.expanded?.get()
|
|
65
|
+
: undefined,
|
|
66
|
+
],
|
|
67
|
+
},
|
|
53
68
|
table_getRowId: {
|
|
54
69
|
fn: (originalRow, index, parent) =>
|
|
55
70
|
table_getRowId(originalRow, table, index, parent),
|
|
@@ -13,6 +13,7 @@ export interface Row_CoreProperties<
|
|
|
13
13
|
Column<TFeatures, TData, unknown>,
|
|
14
14
|
Cell<TFeatures, TData, unknown>
|
|
15
15
|
>
|
|
16
|
+
_displayIndexCache: number
|
|
16
17
|
_uniqueValuesCache: Record<string, unknown>
|
|
17
18
|
_valuesCache: Record<string, unknown>
|
|
18
19
|
/**
|
|
@@ -53,6 +54,11 @@ export interface Row_Row<
|
|
|
53
54
|
in out TFeatures extends TableFeatures,
|
|
54
55
|
in out TData extends RowData,
|
|
55
56
|
> extends Row_CoreProperties<TFeatures, TData> {
|
|
57
|
+
/**
|
|
58
|
+
* Returns the zero-based index of the row in the current display order
|
|
59
|
+
* before pagination, or `-1` if the row is not in that model.
|
|
60
|
+
*/
|
|
61
|
+
getDisplayIndex: () => number
|
|
56
62
|
/**
|
|
57
63
|
* Builds a lookup of this row's cells keyed by leaf column id.
|
|
58
64
|
*/
|
|
@@ -114,6 +120,13 @@ export interface Table_Rows<
|
|
|
114
120
|
in out TFeatures extends TableFeatures,
|
|
115
121
|
in out TData extends RowData,
|
|
116
122
|
> {
|
|
123
|
+
/**
|
|
124
|
+
* Returns the rows in the current display order and assigns their display
|
|
125
|
+
* indexes. When expanded rows bypass pagination, expanded descendants are
|
|
126
|
+
* included in this order. This is the memoized source for
|
|
127
|
+
* `row.getDisplayIndex()`.
|
|
128
|
+
*/
|
|
129
|
+
getRowsInDisplayOrder: () => Array<Row<TFeatures, TData>>
|
|
117
130
|
getRowId: (_: TData, index: number, parent?: Row<TFeatures, TData>) => string
|
|
118
131
|
/**
|
|
119
132
|
* Returns the row with the given ID.
|
|
@@ -5,6 +5,64 @@ import type { RowData } from '../../types/type-utils'
|
|
|
5
5
|
import type { TableFeatures } from '../../types/TableFeatures'
|
|
6
6
|
import type { Row } from '../../types/Row'
|
|
7
7
|
import type { Cell } from '../../types/Cell'
|
|
8
|
+
import type { Row_RowExpanding } from '../../features/row-expanding/rowExpandingFeature.types'
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Returns this row's zero-based position in the current pre-pagination row
|
|
12
|
+
* model. Rows outside that model return `-1`.
|
|
13
|
+
*/
|
|
14
|
+
export function row_getDisplayIndex<
|
|
15
|
+
TFeatures extends TableFeatures,
|
|
16
|
+
TData extends RowData,
|
|
17
|
+
>(row: Row<TFeatures, TData>) {
|
|
18
|
+
const rows = row.table.getRowsInDisplayOrder()
|
|
19
|
+
const displayIndex = row._displayIndexCache
|
|
20
|
+
|
|
21
|
+
return rows[displayIndex] === row ? displayIndex : -1
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Returns the rows in the current display order after assigning their
|
|
26
|
+
* zero-based display indexes.
|
|
27
|
+
*
|
|
28
|
+
* When expanded rows bypass pagination, expanded descendants are inserted into
|
|
29
|
+
* the returned order even though they are absent from the pre-pagination row
|
|
30
|
+
* model.
|
|
31
|
+
*/
|
|
32
|
+
export function table_getRowsInDisplayOrder<
|
|
33
|
+
TFeatures extends TableFeatures,
|
|
34
|
+
TData extends RowData,
|
|
35
|
+
>(table: Table_Internal<TFeatures, TData>) {
|
|
36
|
+
const rows = table.getPrePaginatedRowModel().rows
|
|
37
|
+
|
|
38
|
+
if (table.options.paginateExpandedRows === false) {
|
|
39
|
+
const displayRows: Array<Row<TFeatures, TData>> = []
|
|
40
|
+
|
|
41
|
+
const handleRow = (row: Row<TFeatures, TData>) => {
|
|
42
|
+
row._displayIndexCache = displayRows.length
|
|
43
|
+
displayRows.push(row)
|
|
44
|
+
|
|
45
|
+
if (
|
|
46
|
+
row.subRows.length &&
|
|
47
|
+
(
|
|
48
|
+
row as Row<TFeatures, TData> & Partial<Row_RowExpanding>
|
|
49
|
+
).getIsExpanded?.()
|
|
50
|
+
) {
|
|
51
|
+
row.subRows.forEach(handleRow)
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
rows.forEach(handleRow)
|
|
56
|
+
|
|
57
|
+
return displayRows
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
for (let i = 0; i < rows.length; i++) {
|
|
61
|
+
rows[i]!._displayIndexCache = i
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return rows
|
|
65
|
+
}
|
|
8
66
|
|
|
9
67
|
/**
|
|
10
68
|
* Reads and caches this row's value for a column.
|