Skip to content

Commit

Permalink
chore: add jsdoc to apis and options (#5089)
Browse files Browse the repository at this point in the history
* add jsdoc comments

* clean up more types and jsdoc links

* add jsdoc and docs for header groups
  • Loading branch information
KevinVandy authored Sep 24, 2023
1 parent bf56162 commit f1be41d
Show file tree
Hide file tree
Showing 30 changed files with 2,163 additions and 262 deletions.
12 changes: 10 additions & 2 deletions docs/api/core/cell.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ getValue: () => any

Returns the value for the cell, accessed via the associated column's accessor key or accessor function.

### `renderValue`

```tsx
renderValue: () => any
```

Renders the value for a cell the same as `getValue`, but will return the `renderFallbackValue` if no value is found.

### `row`

```tsx
Expand All @@ -48,8 +56,8 @@ getContext: () => {
column: Column<TData, TValue>
row: Row<TData>
cell: Cell<TData, TValue>
getValue: <TTValue = TValue>() => TTValue
renderValue: <TTValue = TValue>() => TTValue | null
getValue: <TTValue = TValue,>() => TTValue
renderValue: <TTValue = TValue,>() => TTValue | null
}
```

Expand Down
130 changes: 130 additions & 0 deletions docs/api/core/header.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,133 @@ Returns the rendering context (or props) for column-based components like header
```tsx
flexRender(header.column.columnDef.header, header.getContext())
```
## Table API
### `getHeaderGroups`
```tsx
type getHeaderGroups = () => HeaderGroup<TData>[]
```
Returns all header groups for the table.
### `getLeftHeaderGroups`
```tsx
type getLeftHeaderGroups = () => HeaderGroup<TData>[]
```
If pinning, returns the header groups for the left pinned columns.
### `getCenterHeaderGroups`
```tsx
type getCenterHeaderGroups = () => HeaderGroup<TData>[]
```
If pinning, returns the header groups for columns that are not pinned.
### `getRightHeaderGroups`
```tsx
type getRightHeaderGroups = () => HeaderGroup<TData>[]
```
If pinning, returns the header groups for the right pinned columns.
### `getFooterGroups`
```tsx
type getFooterGroups = () => HeaderGroup<TData>[]
```
Returns all footer groups for the table.
### `getLeftFooterGroups`
```tsx
type getLeftFooterGroups = () => HeaderGroup<TData>[]
```
If pinning, returns the footer groups for the left pinned columns.
### `getCenterFooterGroups`
```tsx
type getCenterFooterGroups = () => HeaderGroup<TData>[]
```
If pinning, returns the footer groups for columns that are not pinned.
### `getRightFooterGroups`
```tsx
type getRightFooterGroups = () => HeaderGroup<TData>[]
```
If pinning, returns the footer groups for the right pinned columns.
### `getFlatHeaders`
```tsx
type getFlatHeaders = () => Header<TData, unknown>[]
```
Returns headers for all columns in the table, including parent headers.
### `getLeftFlatHeaders`
```tsx
type getLeftFlatHeaders = () => Header<TData, unknown>[]
```
If pinning, returns headers for all left pinned columns in the table, including parent headers.
### `getCenterFlatHeaders`
```tsx
type getCenterFlatHeaders = () => Header<TData, unknown>[]
```
If pinning, returns headers for all columns that are not pinned, including parent headers.
### `getRightFlatHeaders`
```tsx
type getRightFlatHeaders = () => Header<TData, unknown>[]
```
If pinning, returns headers for all right pinned columns in the table, including parent headers.
### `getLeafHeaders`
```tsx
type getLeafHeaders = () => Header<TData, unknown>[]
```
Returns headers for all leaf columns in the table, (not including parent headers).
### `getLeftLeafHeaders`
```tsx
type getLeftLeafHeaders = () => Header<TData, unknown>[]
```
If pinning, returns headers for all left pinned leaf columns in the table, (not including parent headers).
### `getCenterLeafHeaders`
```tsx
type getCenterLeafHeaders = () => Header<TData, unknown>[]
```
If pinning, returns headers for all columns that are not pinned, (not including parent headers).
### `getRightLeafHeaders`
```tsx
type getRightLeafHeaders = () => Header<TData, unknown>[]
```
If pinning, returns headers for all right pinned leaf columns in the table, (not including parent headers).
18 changes: 17 additions & 1 deletion docs/api/core/row.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,27 @@ If nested, this row's parent row id.
### `getValue`

```tsx
getValue: (columnId: string) => any
getValue: (columnId: string) => TValue
```

Returns the value from the row for a given columnId

### `renderValue`

```tsx
renderValue: (columnId: string) => TValue
```

Renders the value from the row for a given columnId, but will return the `renderFallbackValue` if no value is found.

### `getUniqueValues`

```tsx
getUniqueValues: (columnId: string) => TValue[]
```

Returns a unique array of values from the row for a given columnId.

### `subRows`

```tsx
Expand Down
20 changes: 15 additions & 5 deletions docs/api/features/column-visibility.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,39 +82,39 @@ Enables/disables hiding of columns.
### `getVisibleFlatColumns`
```tsx
getVisibleFlatColumns: () => Column < TData > []
getVisibleFlatColumns: () => Column<TData>[]
```
Returns a flat array of columns that are visible, including parent columns.
### `getVisibleLeafColumns`
```tsx
getVisibleLeafColumns: () => Column < TData > []
getVisibleLeafColumns: () => Column<TData>[]
```
Returns a flat array of leaf-node columns that are visible.
### `getLeftVisibleLeafColumns`
```tsx
getLeftVisibleLeafColumns: () => Column < TData > []
getLeftVisibleLeafColumns: () => Column<TData>[]
```
If column pinning, returns a flat array of leaf-node columns that are visible in the left portion of the table.
### `getRightVisibleLeafColumns`
```tsx
getRightVisibleLeafColumns: () => Column < TData > []
getRightVisibleLeafColumns: () => Column<TData>[]
```
If column pinning, returns a flat array of leaf-node columns that are visible in the right portion of the table.
### `getCenterVisibleLeafColumns`
```tsx
getCenterVisibleLeafColumns: () => Column < TData > []
getCenterVisibleLeafColumns: () => Column<TData>[]
```
If column pinning, returns a flat array of leaf-node columns that are visible in the unpinned/center portion of the table.
Expand Down Expand Up @@ -166,3 +166,13 @@ getToggleAllColumnsVisibilityHandler: () => ((event: unknown) => void)
```
Returns a handler for toggling the visibility of all columns, meant to be bound to a `input[type=checkbox]` element.
## Row API
### `getVisibleCells`
```tsx
getVisibleCells: () => Cell<TData>[]
```
Returns an array of cells that account for column visibility for the row.
8 changes: 8 additions & 0 deletions docs/api/features/expanding.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@ getIsExpanded: () => boolean
Returns whether the row is expanded.
### `getIsAllParentsExpanded`
```tsx
getIsAllParentsExpanded: () => boolean
```
Returns whether all parent rows of the row are expanded.
### `getCanExpand`
```tsx
Expand Down
2 changes: 1 addition & 1 deletion docs/api/features/filters.md
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ Returns whether or not the column can be **column** filtered.
getCanGlobalFilter: () => boolean
```

Returns whether or not the column can be **globally** filtered.
Returns whether or not the column can be **globally** filtered. Set to `false` to disable a column from being scanned during global filtering.

### `getFilterIndex`

Expand Down
28 changes: 28 additions & 0 deletions docs/api/features/grouping.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,8 @@ Returns the automatically inferred aggregation function for the column.
getAggregationFn: () => AggregationFn<TData> | undefined
```
Returns the aggregation function for the column.
## Row API
### `groupingColumnId`
Expand Down Expand Up @@ -323,3 +325,29 @@ getGroupedRowModel: () => RowModel<TData>
```

Returns the row model for the table after grouping has been applied.

## Cell API

### `getIsAggregated`

```tsx
getIsAggregated: () => boolean
```

Returns whether or not the cell is currently aggregated.

### `getIsGrouped`

```tsx
getIsGrouped: () => boolean
```

Returns whether or not the cell is currently grouped.

### `getIsPlaceholder`

```tsx
getIsPlaceholder: () => boolean
```

Returns whether or not the cell is currently a placeholder.
Loading

0 comments on commit f1be41d

Please sign in to comment.