Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update deprecated type change #5725

Merged
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ interface ColumnFiltersOptionsBase<
manualFiltering?: boolean
/**
* By default, filtering is done for all rows (max depth of 100), no matter if they are root level parent rows or the child leaf rows of a parent row. Setting this option to `0` will cause filtering to only be applied to the root level parent rows, with all sub-rows remaining unfiltered. Similarly, setting this option to `1` will cause filtering to only be applied to child leaf rows 1 level deep, and so on.

* This is useful for situations where you want a row's entire child hierarchy to be visible regardless of the applied filter.
* @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#maxleafrowfilterdepth)
* @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)
Expand All @@ -213,7 +213,7 @@ type ResolvedFilterFns<
filterFns?: Record<string, FilterFn<TFeatures, TData>>
}
: {
filterFns: Record<keyof FilterFns, FilterFn<TFeatures, TData>>
filterFns: Record<keyof FilterFns, FilterFn<TFeatures, TData>>
}

export interface TableOptions_ColumnFiltering<
Expand All @@ -222,6 +222,16 @@ export interface TableOptions_ColumnFiltering<
> extends ColumnFiltersOptionsBase<TFeatures, TData>,
ResolvedFilterFns<TFeatures, TData> {}

export interface TableOptions_ColumnFiltering_Unavailable<
KevinVandy marked this conversation as resolved.
Show resolved Hide resolved
TFeatures extends TableFeatures,
TData extends RowData,
> extends ColumnFiltersOptionsBase<TFeatures, TData>,
ResolvedFilterFns<TFeatures, TData> {
/**
* @description Allows `any`.
*/
}

export interface Table_ColumnFiltering<
TFeatures extends TableFeatures,
TData extends RowData,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ export interface TableState_ColumnGrouping {
grouping: GroupingState
}

export interface TableState_ColumnGrouping_Unavailable {
/**
* @deprecated Import the `GroupingState` feature to use the column grouping APIs.
*/
grouping: GroupingState
}

export interface AggregationFns {}

export type AggregationFn<
Expand Down Expand Up @@ -224,6 +231,16 @@ export interface TableOptions_ColumnGrouping<
> extends GroupingOptionsBase,
ResolvedAggregationFns<TFeatures, TData> {}

export interface TableOptions_ColumnGrouping_Unavailable<
TFeatures extends TableFeatures,
TData extends RowData,
> extends GroupingOptionsBase,
ResolvedAggregationFns<TFeatures, TData> {
/**
* @description Allows `any`.
*/
}

export type GroupingColumnMode = false | 'reorder' | 'remove'

export interface Table_ColumnGrouping<
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ export interface TableState_ColumnOrdering {
columnOrder: ColumnOrderState
}

export interface TableState_ColumnOrdering_Unavailable {
/**
* @deprecated Import the `ColumnOrderState` feature to use the column ordering APIs.
*/
columnOrder: ColumnOrderState
}

export interface TableOptions_ColumnOrdering {
/**
* If provided, this function will be called with an `updaterFn` when `state.columnOrder` changes. This overrides the default internal state management, so you will need to persist the state change either fully or partially outside of the table.
Expand All @@ -18,6 +25,13 @@ export interface TableOptions_ColumnOrdering {
onColumnOrderChange?: OnChangeFn<ColumnOrderState>
}

export interface TableOptions_ColumnOrdering_Unavailable {
/**
* @deprecated Import the `OnChangeFn<ColumnOrderState>` feature to use the table options column ordering APIs.
*/
onColumnOrderChange?: OnChangeFn<ColumnOrderState>
}

export interface Column_ColumnOrdering {
/**
* Returns the index of the column in the order of the visible columns. Optionally pass a `position` parameter to get the index of the column in a sub-section of the table
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,36 @@ export interface TableState_ColumnPinning {
columnPinning: ColumnPinningState
}

export interface TableState_ColumnPinning_Unavailable {
/**
* @deprecated Import the `ColumnPinningState` feature to use the column pinning APIs.
*/
columnPinning: ColumnPinningState
}

export interface TableOptions_ColumnPinning {
/**
* Enables/disables column pinning for the table. Defaults to `true`.
* @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#enablecolumnpinning)
* @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)
*/
enableColumnPinning?: boolean
/**
* If provided, this function will be called with an `updaterFn` when `state.columnPinning` changes. This overrides the default internal state management, so you will also need to supply `state.columnPinning` from your own managed state.
* @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#oncolumnpinningchange)
* @link [Guide](https://tanstack.com/table/v8/docs/guide/oncolumnpinningchange)
*/
onColumnPinningChange?: OnChangeFn<ColumnPinningState>
}

export interface TableOptions_ColumnPinning_Unavailable {
/**
* @deprecated Use `enableColumnPinning` or `enableRowPinning` instead.
* Enables/disables all pinning for the table. Defaults to `true`.
* @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#enablepinning)
* @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)
*/
enablePinning?: boolean
/**
* If provided, this function will be called with an `updaterFn` when `state.columnPinning` changes. This overrides the default internal state management, so you will also need to supply `state.columnPinning` from your own managed state.
* @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#oncolumnpinningchange)
* @link [Guide](https://tanstack.com/table/v8/docs/guide/oncolumnpinningchange)
*/
onColumnPinningChange?: OnChangeFn<ColumnPinningState>
}

export interface ColumnPinningDefaultOptions {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ export interface TableState_ColumnResizing {
columnSizingInfo: ColumnResizingInfoState
}

export interface TableState_ColumnResizing_Unavailable {
/**
* @deprecated Import the `ColumnResizingInfoState` feature to use the column resizing information APIs.
*/
columnSizingInfo: ColumnResizingInfoState
}

export interface ColumnResizingInfoState {
columnSizingStart: Array<[string, number]>
deltaOffset: null | number
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ export interface TableState_ColumnSizing {
columnSizing: ColumnSizingState
}

export interface TableState_ColumnSizing_Unavailable {
/**
* @deprecated Import the `ColumnSizingState` feature to use the column sizing APIs.
*/
columnSizing: ColumnSizingState
}

export type ColumnSizingState = Record<string, number>

export interface TableOptions_ColumnSizing {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ export interface TableState_ColumnVisibility {
columnVisibility: ColumnVisibilityState
}

export interface TableState_ColumnVisibility_Unavailable {
/**
* @deprecated Import the `ColumnVisibilityState` feature to use the column visibility APIs.
*/
columnVisibility: ColumnVisibilityState
}

export interface TableOptions_ColumnVisibility {
/**
* Whether to enable column hiding. Defaults to `true`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ export interface TableState_GlobalFiltering {
globalFilter: any
}

export interface TableState_GlobalFiltering_Unavailable {
/**
* @deprecated Import the `GlobalFilteringState` feature to use the global filtering APIs.
*/
globalFilter: any
}

export interface ColumnDef_GlobalFiltering {
/**
* Enables/disables the **global** filter for this column.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ export interface TableState_RowExpanding {
expanded: ExpandedState
}

export interface TableState_RowExpanding_Unavailable {
/**
* @deprecated Import the `ExpandedState` feature to use the row expansion APIs.
*/
expanded: ExpandedState
}

export interface Row_RowExpanding {
/**
* Returns whether the row can be expanded.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ export interface PaginationState {
export interface TableState_RowPagination {
pagination: PaginationState
}
export interface TableState_RowPagination_Unavailable {
/**
* @deprecated Import the `PaginationState` feature to use the row pagination APIs.
*/
pagination: PaginationState
}

export interface TableOptions_RowPagination {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ export interface TableState_RowPinning {
rowPinning: RowPinningState
}

export interface TableState_RowPinning_Unavailable {
/**
* @deprecated Import the `RowPinningState` feature to use the row pinning APIs.
*/
rowPinning: RowPinningState
}

export interface TableOptions_RowPinning<
TFeatures extends TableFeatures,
TData extends RowData,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ export interface TableState_RowSelection {
rowSelection: RowSelectionState
}

export interface TableState_RowSelection_Unavailable {
/**
* @deprecated Import the `RowSelectionState` feature to use the row selection APIs.
*/
rowSelection: RowSelectionState
}

export interface TableOptions_RowSelection<
TFeatures extends TableFeatures,
TData extends RowData,
Expand Down
11 changes: 11 additions & 0 deletions packages/table-core/src/features/row-sorting/RowSorting.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,17 @@ export interface TableState_RowSorting {
sorting: SortingState
}

export interface TableState_RowSorting {
sorting: SortingState
}

export interface TableState_RowSorting_Unavailable {
/**
* @deprecated Import the `SortingState` feature to use the row sorting APIs.
*/
sorting: SortingState
}

export interface SortingFns {}

export interface SortingFn<
Expand Down
28 changes: 20 additions & 8 deletions packages/table-core/src/types/TableOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,22 @@ import type { TableOptions_Columns } from '../core/columns/Columns.types'
import type { TableOptions_Headers } from '../core/headers/Headers.types'
import type { TableOptions_Rows } from '../core/rows/Rows.types'
import type { TableOptions_Table } from '../core/table/Tables.types'
import type { TableOptions_ColumnFiltering } from '../features/column-filtering/ColumnFiltering.types'
import type { TableOptions_ColumnGrouping } from '../features/column-grouping/ColumnGrouping.types'
import type { TableOptions_ColumnOrdering } from '../features/column-ordering/ColumnOrdering.types'
import type { TableOptions_ColumnPinning } from '../features/column-pinning/ColumnPinning.types'
import type {
TableOptions_ColumnFiltering,
TableOptions_ColumnFiltering_Unavailable,
} from '../features/column-filtering/ColumnFiltering.types'
import type {
TableOptions_ColumnGrouping,
TableOptions_ColumnGrouping_Unavailable,
} from '../features/column-grouping/ColumnGrouping.types'
import type {
TableOptions_ColumnOrdering,
TableOptions_ColumnOrdering_Unavailable,
} from '../features/column-ordering/ColumnOrdering.types'
import type {
TableOptions_ColumnPinning,
TableOptions_ColumnPinning_Unavailable,
} from '../features/column-pinning/ColumnPinning.types'
import type { TableOptions_ColumnResizing } from '../features/column-resizing/ColumnResizing.types'
import type { TableOptions_ColumnSizing } from '../features/column-sizing/ColumnSizing.types'
import type { TableOptions_ColumnVisibility } from '../features/column-visibility/ColumnVisibility.types'
Expand Down Expand Up @@ -35,16 +47,16 @@ export type TableOptions<
UnionToIntersection<
| ('ColumnFiltering' extends keyof TFeatures
? TableOptions_ColumnFiltering<TFeatures, TData>
: never)
: TableOptions_ColumnFiltering_Unavailable<TFeatures, TData>)
| ('ColumnGrouping' extends keyof TFeatures
? TableOptions_ColumnGrouping<TFeatures, TData>
: never)
: TableOptions_ColumnGrouping_Unavailable<TFeatures, TData>)
| ('ColumnOrdering' extends keyof TFeatures
? TableOptions_ColumnOrdering
: never)
: TableOptions_ColumnOrdering_Unavailable)
| ('ColumnPinning' extends keyof TFeatures
? TableOptions_ColumnPinning
: never)
: TableOptions_ColumnPinning_Unavailable)
| ('ColumnResizing' extends keyof TFeatures
? TableOptions_ColumnResizing
: never)
Expand Down
Loading
Loading