mirror of
https://github.com/TanStack/table.git
synced 2026-11-18 18:55:54 +00:00
* feat(table-core): Further improve tree-shaking across features Keep column ordering, column pinning, and row expanding code out of the core bundle, route more cross-feature reads through feature stubs, and stop allocating unused onAfterUpdate wrappers in production memos. * refactor(table-core): register internal cross-feature fns as table APIs Replace init*InstanceData function storage with @internal table APIs registered via assignTableAPIs, route faceting through the getCanGlobalFilter stub, and enforce feature boundaries with import/no-restricted-paths. Regenerate reference docs and fix stale docs config links. ---------
1.5 KiB
1.5 KiB
| id | title |
|---|---|
| constructSortFn | constructSortFn |
function constructSortFn<TFeatures, TData>(def): CreatedSortFn<TFeatures, TData>;
Defined in: features/row-sorting/sortFns.ts:39
Builds a SortFn from a value-level comparator plus an optional
resolveDataValue normalizer.
The sort comparator receives both rows' data values, each already passed
through resolveDataValue when one is defined. Keeping normalization in the
resolver means a variant of an existing sorting function only has to swap
the resolver, not re-implement the comparison.
The definition is attached to the returned function, so a variant can be created by spreading a built-in sorting function and overriding what differs:
const stripDiacritics = (value: string) =>
value.normalize('NFD').replace(/\p{Diacritic}/gu, '')
const alphanumericIgnoreDiacritics = constructSortFn({
...sortFn_alphanumeric,
resolveDataValue: (value) =>
stripDiacritics(sortFn_alphanumeric.resolveDataValue!(value)),
})
Type Parameters
TFeatures
TFeatures extends TableFeatures = any
TData
TData extends RowData = any
Parameters
def
SortFnDef<TFeatures, TData>
Returns
CreatedSortFn<TFeatures, TData>