mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 02:11:05 +00:00
feat(data-table): support programmatic sorting (#1337)
* refactor(data-table): pass down sortable props instead of using context * feat(data-table): support programmatic sorting * test(data-table): assert new props * docs(data-table): add "Programmatic sorting" example * refactor(data-table): remove unused tableSortable store * refactor(data-table): remove unused indices
This commit is contained in:
parent
d2cdb8eb0f
commit
72c24b83b2
9 changed files with 241 additions and 48 deletions
12
types/DataTable/DataTable.svelte.d.ts
vendored
12
types/DataTable/DataTable.svelte.d.ts
vendored
|
@ -85,6 +85,18 @@ export interface DataTableProps
|
|||
*/
|
||||
sortable?: boolean;
|
||||
|
||||
/**
|
||||
* Specify the header key to sort by
|
||||
* @default null
|
||||
*/
|
||||
sortKey?: DataTableKey;
|
||||
|
||||
/**
|
||||
* Specify the sort direction
|
||||
* @default "none"
|
||||
*/
|
||||
sortDirection?: "none" | "ascending" | "descending";
|
||||
|
||||
/**
|
||||
* Set to `true` for the expandable variant
|
||||
* Automatically set to `true` if `batchExpansion` is `true`
|
||||
|
|
16
types/DataTable/TableHeader.svelte.d.ts
vendored
16
types/DataTable/TableHeader.svelte.d.ts
vendored
|
@ -4,10 +4,22 @@ import type { SvelteComponentTyped } from "svelte";
|
|||
export interface TableHeaderProps
|
||||
extends svelte.JSX.HTMLAttributes<HTMLElementTagNameMap["th"]> {
|
||||
/**
|
||||
* Set to `true` to disable sorting on this specific cell
|
||||
* Set to `true` for the sortable variant
|
||||
* @default false
|
||||
*/
|
||||
disableSorting?: boolean;
|
||||
sortable?: boolean;
|
||||
|
||||
/**
|
||||
* Specify the sort direction
|
||||
* @default "none"
|
||||
*/
|
||||
sortDirection?: "none" | "ascending" | "descending";
|
||||
|
||||
/**
|
||||
* Set to `true` if the column sorting
|
||||
* @default false
|
||||
*/
|
||||
active?: boolean;
|
||||
|
||||
/**
|
||||
* Specify the `scope` attribute
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue