Skip to content

Commit

Permalink
rename processingFns to rowModelFns
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinVandy committed Nov 22, 2024
1 parent de4fcdf commit feb1c6d
Show file tree
Hide file tree
Showing 28 changed files with 47 additions and 47 deletions.
2 changes: 1 addition & 1 deletion docs/guide/sorting.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ const table = useTable({
})
```

### Sorting ProcessingFns
### Sorting RowModelFns

The default sorting function for all columns is inferred from the data type of the column. However, it can be useful to define the exact sorting function that you want to use for a specific column, especially if any of your data is nullable or not a standard data type.

Expand Down
2 changes: 1 addition & 1 deletion examples/react/basic-table-helper/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const defaultData: Array<Person> = [
const tableHelper = createTableHelper({
_features: {},
_rowModels: {}, // client-side row models. `Core` row model is now included by default, but you can still override it here
_processingFns: {}, // client-side processing functions used by the row models (sorting, filtering, etc.). Not needed in this basic example
_rowModelFns: {}, // client-side processing functions used by the row models (sorting, filtering, etc.). Not needed in this basic example
debugTable: true,
// TData: {} as Person, // optionally, set the TData type for the table helper. Omit if this will be a table helper for multiple tables of all different data types
})
Expand Down
2 changes: 1 addition & 1 deletion examples/react/custom-features/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ function App() {
paginatedRowModel: createPaginatedRowModel(),
sortedRowModel: createSortedRowModel(),
},
_processingFns: {
_rowModelFns: {
filterFns,
sortFns,
},
Expand Down
2 changes: 1 addition & 1 deletion examples/react/expanding/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const tableHelper = createTableHelper({
rowSortingFeature,
rowSelectionFeature,
},
_processingFns: {
_rowModelFns: {
filterFns: filterFns,
sortFns: sortFns,
},
Expand Down
2 changes: 1 addition & 1 deletion examples/react/filters-faceted/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ function App() {

const table = useTable({
_features,
_processingFns: {
_rowModelFns: {
filterFns,
sortFns,
},
Expand Down
6 changes: 3 additions & 3 deletions examples/react/filters-fuzzy/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ const fuzzySort: SortingFn<typeof _features, Person> = (
// Only sort by rank if the column has ranking information
if (rowA.columnFiltersMeta[columnId]) {
dir = compareItems(
rowA.columnFiltersMeta[columnId].itemRank,
rowB.columnFiltersMeta[columnId].itemRank,
rowA.columnFiltersMeta[columnId].itemRank!,
rowB.columnFiltersMeta[columnId].itemRank!,
)
}

Expand Down Expand Up @@ -131,7 +131,7 @@ function App() {

const table = useTable<typeof _features, Person>({
_features,
_processingFns: {
_rowModelFns: {
filterFns,
},
_rowModels: {
Expand Down
2 changes: 1 addition & 1 deletion examples/react/filters/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ function App() {
sortedRowModel: createSortedRowModel(),
paginatedRowModel: createPaginatedRowModel(),
},
_processingFns: {
_rowModelFns: {
filterFns, // client side filtering
sortFns,
},
Expand Down
6 changes: 3 additions & 3 deletions examples/react/pagination/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
createSortedRowModel,
filterFns,
flexRender,
processingFns,
rowModelFns,
rowPaginationFeature,
rowSortingFeature,
sortFns,
Expand All @@ -30,7 +30,7 @@ const _features = tableFeatures({
rowSortingFeature,
})

const _processingFns = processingFns(_features, {
const _rowModelFns = rowModelFns(_features, {
sortFns,
filterFns,
})
Expand Down Expand Up @@ -107,7 +107,7 @@ function MyTable({

const table = useTable({
_features,
_processingFns,
_rowModelFns,
_rowModels: {
sortedRowModel: createSortedRowModel(),
filteredRowModel: createFilteredRowModel(),
Expand Down
4 changes: 2 additions & 2 deletions examples/react/sorting/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@

// const table = useTable({
// _features,
// _processingFns: {
// _rowModelFns: {
// sortFns,
// },
// _rowModels: {
Expand Down Expand Up @@ -224,7 +224,7 @@ export const useReactTable = createTableHelper({
groupedRowModel: createGroupedRowModel(),
expandedRowModel: createExpandedRowModel(),
},
_processingFns: {
_rowModelFns: {
sortFns,
filterFns,
aggregationFns,
Expand Down
2 changes: 1 addition & 1 deletion examples/solid/basic-table-helper/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const defaultData: Array<Person> = [
const tableHelper = createTableHelper({
_features: {},
_rowModels: {}, // client-side row models. `Core` row model is now included by default, but you can still override it here
_processingFns: {}, // client-side processing functions used by the row models (sorting, filtering, etc.). Not needed in this basic example
_rowModelFns: {}, // client-side processing functions used by the row models (sorting, filtering, etc.). Not needed in this basic example
TData: {} as Person,
debugTable: true,
})
Expand Down
2 changes: 1 addition & 1 deletion examples/solid/filters/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ function App() {
facetedUniqueValues: createFacetedUniqueValues(),
filteredRowModel: createFilteredRowModel(),
},
_processingFns: {
_rowModelFns: {
filterFns,
},
get data() {
Expand Down
2 changes: 1 addition & 1 deletion examples/svelte/basic-table-helper/src/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
const tableHelper = createTableHelper({
_features: { columnSizingFeature: {} },
_rowModels: {}, // client-side row models. `Core` row model is now included by default, but you can still override it here
_processingFns: {}, // client-side processing functions used by the row models (sorting, filtering, etc.). Not needed in this basic example
_rowModelFns: {}, // client-side processing functions used by the row models (sorting, filtering, etc.). Not needed in this basic example
debugTable: true,
// TData: {} as Person, // optionally, set the TData type for the table helper. Omit if this will be a table helper for multiple tables of all different data types
})
Expand Down
2 changes: 1 addition & 1 deletion examples/svelte/filtering/src/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
filteredRowModel: createFilteredRowModel(),
paginatedRowModel: createPaginatedRowModel(),
},
_processingFns: {
_rowModelFns: {
filterFns: {
fuzzy: fuzzyFilter,
},
Expand Down
2 changes: 1 addition & 1 deletion examples/svelte/sorting/src/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
_rowModels: {
sortedRowModel: createSortedRowModel(),
},
_processingFns: {
_rowModelFns: {
sortFns,
},
get data() {
Expand Down
2 changes: 1 addition & 1 deletion packages/react-table/src/createTableHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export type TableHelper<
useTable: <TData extends RowData>(
tableOptions: Omit<
TableOptions<TFeatures, TData>,
'_features' | '_rowModels' | '_processingFns'
'_features' | '_rowModels' | '_rowModelFns'
>,
) => Table<TFeatures, TData>
}
Expand Down
2 changes: 1 addition & 1 deletion packages/solid-table/src/createTableHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export type TableHelper<
createTable: (
tableOptions: Omit<
TableOptions<TFeatures, TData>,
'_features' | '_rowModels' | '_processingFns'
'_features' | '_rowModels' | '_rowModelFns'
>,
) => Table<TFeatures, TData>
}
Expand Down
2 changes: 1 addition & 1 deletion packages/svelte-table/src/createTableHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export type TableHelper<
createTable: (
tableOptions: Omit<
TableOptions<TFeatures, TData>,
'_features' | '_rowModels' | '_processingFns'
'_features' | '_rowModels' | '_rowModelFns'
>,
) => Table<TFeatures, TData>
}
Expand Down
2 changes: 1 addition & 1 deletion packages/table-core/src/core/table/constructTable.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe('constructTable', () => {
expect(table).toBeDefined()
// core table properties
expect(table).toHaveProperty('_features')
expect(table).toHaveProperty('_processingFns')
expect(table).toHaveProperty('_rowModelFns')
expect(table).toHaveProperty('_rowModels')
expect(table).toHaveProperty('initialState')
expect(table).toHaveProperty('options')
Expand Down
4 changes: 2 additions & 2 deletions packages/table-core/src/core/table/constructTable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export function constructTable<
console.info('Constructing Table Instance...')
}

const { _features = {} as TFeatures, _processingFns = {} } = options
const { _features = {} as TFeatures, _rowModelFns = {} } = options

const featuresList: Array<TableFeature> = Object.values(_features)

Expand All @@ -41,8 +41,8 @@ export function constructTable<

const coreInstance: Table_CoreProperties<TFeatures, TData> = {
_features, // features get stored here immediately
_processingFns, // processing functions get stored here
_rowModels: {} as CachedRowModels<TFeatures, TData>, // row models get cached here later
_rowModelFns, // row model processing functions get stored here
options: {
...defaultOptions,
...options,
Expand Down
14 changes: 7 additions & 7 deletions packages/table-core/src/core/table/tablesFeature.types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { ProcessingFns } from '../../types/ProcessingFns'
import type { RowModelFns } from '../../types/RowModelFns'
import type { RowData, Updater } from '../../types/type-utils'
import type {
CoreTableFeatures,
Expand All @@ -24,11 +24,11 @@ export interface TableOptions_Table<
*/
_features: TFeatures
/**
* The processing functions that are used to process the data by features.
* [API Docs](https://tanstack.com/table/v8/docs/api/core/table#_processingFns)
* The row model processing functions that are used to process the data by features.
* [API Docs](https://tanstack.com/table/v8/docs/api/core/table#_rowModelFns)
* [Guide](https://tanstack.com/table/v8/docs/guide/tables)
*/
_processingFns?: ProcessingFns<TFeatures, NoInfer<TData>>
_rowModelFns?: RowModelFns<TFeatures, NoInfer<TData>>
/**
* The row model options that you want to enable for the table.
* [API Docs](https://tanstack.com/table/v8/docs/api/core/table#_rowmodels)
Expand Down Expand Up @@ -115,11 +115,11 @@ export interface Table_CoreProperties<
*/
_features: CoreTableFeatures & TFeatures
/**
* The processing functions that are used to process the data by features.
* [API Docs](https://tanstack.com/table/v8/docs/api/core/table#_processingFns)
* The row model processing functions that are used to process the data by features.
* [API Docs](https://tanstack.com/table/v8/docs/api/core/table#_rowModelFns)
* [Guide](https://tanstack.com/table/v8/docs/guide/tables)
*/
_processingFns: ProcessingFns<TFeatures, TData>
_rowModelFns: RowModelFns<TFeatures, TData>
/**
* The row models that are enabled for the table.
* [API Docs](https://tanstack.com/table/v8/docs/api/core/table#_rowmodels)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export function column_getAutoFilterFn<
TData extends RowData,
TValue extends CellData = CellData,
>(column: Column<TFeatures, TData, TValue>) {
const filterFns = column.table._processingFns.filterFns as
const filterFns = column.table._rowModelFns.filterFns as
| Record<string, FilterFn<TFeatures, TData>>
| undefined

Expand Down Expand Up @@ -60,7 +60,7 @@ export function column_getFilterFn<
},
): FilterFn<TFeatures, TData> | undefined {
let filterFn = null
const filterFns = column.table._processingFns.filterFns as
const filterFns = column.table._rowModelFns.filterFns as
| Record<string, FilterFn<TFeatures, TData>>
| undefined
filterFn = isFunction(column.columnDef.filterFn)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export function column_getAutoAggregationFn<
columnDef: Partial<ColumnDef_ColumnGrouping<TFeatures, TData>>
},
) {
const aggregationFns = column.table._processingFns.aggregationFns as
const aggregationFns = column.table._rowModelFns.aggregationFns as
| Record<string, AggregationFn<TFeatures, TData>>
| undefined

Expand All @@ -124,7 +124,7 @@ export function column_getAggregationFn<
columnDef: Partial<ColumnDef_ColumnGrouping<TFeatures, TData>>
},
) {
const aggregationFns = column.table._processingFns.aggregationFns as
const aggregationFns = column.table._rowModelFns.aggregationFns as
| Record<string, AggregationFn<TFeatures, TData>>
| undefined

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export function table_getGlobalFilterFn<
table: Table_Internal<TFeatures, TData>,
): FilterFn<TFeatures, TData> | FilterFn<TFeatures, TData> | undefined {
const { globalFilterFn: globalFilterFn } = table.options
const filterFns = table._processingFns.filterFns as
const filterFns = table._rowModelFns.filterFns as
| Record<string, FilterFn<TFeatures, TData>>
| undefined

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export function column_getAutoSortingFn<
>(
column: Column_Internal<TFeatures, TData, TValue>,
): SortingFn<TFeatures, TData> {
const sortFns = column.table._processingFns.sortFns as
const sortFns = column.table._rowModelFns.sortFns as
| Record<string, SortingFn<TFeatures, TData>>
| undefined

Expand Down Expand Up @@ -98,7 +98,7 @@ export function column_getSortingFn<
>(
column: Column_Internal<TFeatures, TData, TValue>,
): SortingFn<TFeatures, TData> {
const sortFns = column.table._processingFns.sortFns as
const sortFns = column.table._rowModelFns.sortFns as
| Record<string, SortingFn<TFeatures, TData>>
| undefined

Expand Down
2 changes: 1 addition & 1 deletion packages/table-core/src/helpers/tableHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export type TableHelper_Core<
tableCreator: <TData extends RowData>(
tableOptions: Omit<
TableOptions<TFeatures, TData>,
'_features' | '_rowModels' | '_processingFns'
'_features' | '_rowModels' | '_rowModelFns'
>,
) => Table<TFeatures, TData>
}
Expand Down
2 changes: 1 addition & 1 deletion packages/table-core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export * from './core/table/tablesFeature.types'
export * from './core/table/tablesFeature.utils'

/**
* ProcessingFns
* RowModelFns
*/

export * from './fns/aggregationFns'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import type { RowData, UnionToIntersection } from './type-utils'
import type { TableFns_ColumnFiltering } from '../features/column-filtering/columnFilteringFeature.types'
import type { TableFeatures } from './TableFeatures'

export interface ProcessingFns_Plugins {}
export interface RowModelFns_Plugins {}

export type ProcessingFns<
export type RowModelFns<
TFeatures extends TableFeatures,
TData extends RowData,
> = ProcessingFns_Plugins &
> = RowModelFns_Plugins &
Partial<
UnionToIntersection<
| ('columnFilteringFeature' extends keyof TFeatures
Expand All @@ -24,7 +24,7 @@ export type ProcessingFns<
>
>

export type ProcessingFns_All<
export type RowModelFns_All<
TFeatures extends TableFeatures,
TData extends RowData,
> = Partial<
Expand Down
4 changes: 2 additions & 2 deletions packages/table-core/src/types/Table.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Table_RowModels } from '../core/row-models/rowModelsFeature.types'
import type { CachedRowModel_All, CreateRowModels_All } from './RowModel'
import type { ProcessingFns_All } from './ProcessingFns'
import type { RowModelFns_All } from './RowModelFns'
import type { TableState_All } from './TableState'
import type { RowData, UnionToIntersection } from './type-utils'
import type { TableFeatures } from './TableFeatures'
Expand Down Expand Up @@ -96,8 +96,8 @@ export type Table_Internal<
TFeatures extends TableFeatures,
TData extends RowData,
> = Table<TFeatures, TData> & {
_processingFns: ProcessingFns_All<TFeatures, TData>
_rowModels: CachedRowModel_All<TFeatures, TData>
_rowModelFns: RowModelFns_All<TFeatures, TData>
options: TableOptions_All<TFeatures, TData> & {
_rowModels?: CreateRowModels_All<TFeatures, TData>
state?: TableState_All
Expand Down

0 comments on commit feb1c6d

Please sign in to comment.