mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 02:11:05 +00:00
refactor(types): rewrite type definitions to account for intrinsic attributes
This commit is contained in:
parent
8c30452169
commit
3c04f122b0
158 changed files with 6997 additions and 5383 deletions
122
types/DataTable/DataTable.d.ts
vendored
Normal file
122
types/DataTable/DataTable.d.ts
vendored
Normal file
|
@ -0,0 +1,122 @@
|
|||
/// <reference types="svelte" />
|
||||
|
||||
type Headers = {
|
||||
key: string;
|
||||
value: string;
|
||||
display?: (item) => string;
|
||||
sort?: (a, b) => number;
|
||||
empty?: boolean;
|
||||
columnMenu?: boolean;
|
||||
}[];
|
||||
|
||||
export default class DataTable {
|
||||
$$prop_def: {
|
||||
/**
|
||||
* Specify the data table headers
|
||||
* @default []
|
||||
*/
|
||||
headers?: Headers;
|
||||
|
||||
/**
|
||||
* Specify the rows the data table should render
|
||||
* keys defined in `headers` are used for the row ids
|
||||
* @default []
|
||||
*/
|
||||
rows?: Object[];
|
||||
|
||||
/**
|
||||
* Set the size of the data table
|
||||
*/
|
||||
size?: "compact" | "short" | "tall";
|
||||
|
||||
/**
|
||||
* Specify the title of the data table
|
||||
* @default ""
|
||||
*/
|
||||
title?: string;
|
||||
|
||||
/**
|
||||
* Specify the description of the data table
|
||||
* @default ""
|
||||
*/
|
||||
description?: string;
|
||||
|
||||
/**
|
||||
* Set to `true` to use zebra styles
|
||||
* @default false
|
||||
*/
|
||||
zebra?: boolean;
|
||||
|
||||
/**
|
||||
* Set to `true` for the sortable variant
|
||||
* @default false
|
||||
*/
|
||||
sortable?: boolean;
|
||||
|
||||
/**
|
||||
* Set to `true` for the expandable variant
|
||||
* Automatically set to `true` if `batchExpansion` is `true`
|
||||
* @default false
|
||||
*/
|
||||
expandable?: boolean;
|
||||
|
||||
/**
|
||||
* Set to `true` to enable batch expansion
|
||||
* @default false
|
||||
*/
|
||||
batchExpansion?: boolean;
|
||||
|
||||
/**
|
||||
* Specify the row ids to be expanded
|
||||
* @default []
|
||||
*/
|
||||
expandedRowIds?: string[];
|
||||
|
||||
/**
|
||||
* Set to `true` for the radio selection variant
|
||||
* @default false
|
||||
*/
|
||||
radio?: boolean;
|
||||
|
||||
/**
|
||||
* Set to `true` for the selectable variant
|
||||
* Automatically set to `true` if `radio` or `batchSelection` are `true`
|
||||
* @default false
|
||||
*/
|
||||
selectable?: boolean;
|
||||
|
||||
/**
|
||||
* Set to `true` to enable batch selection
|
||||
* @default false
|
||||
*/
|
||||
batchSelection?: boolean;
|
||||
|
||||
/**
|
||||
* Specify the row ids to be selected
|
||||
* @default []
|
||||
*/
|
||||
selectedRowIds?: string[];
|
||||
|
||||
/**
|
||||
* Set to `true` to enable a sticky header
|
||||
* @default false
|
||||
*/
|
||||
stickyHeader?: boolean;
|
||||
};
|
||||
|
||||
$$slot_def: {
|
||||
default: {};
|
||||
cell: { row: any; cell: any };
|
||||
["expanded-row"]: { row: any };
|
||||
};
|
||||
|
||||
$on(eventname: "click:header--expand", cb: (event: CustomEvent<any>) => void): () => void;
|
||||
$on(eventname: "click", cb: (event: CustomEvent<any>) => void): () => void;
|
||||
$on(eventname: "click:header", cb: (event: CustomEvent<any>) => void): () => void;
|
||||
$on(eventname: "click:row", cb: (event: CustomEvent<any>) => void): () => void;
|
||||
$on(eventname: "mouseenter:row", cb: (event: CustomEvent<any>) => void): () => void;
|
||||
$on(eventname: "mouseleave:row", cb: (event: CustomEvent<any>) => void): () => void;
|
||||
$on(eventname: "click:row--expand", cb: (event: CustomEvent<any>) => void): () => void;
|
||||
$on(eventname: "click:cell", cb: (event: CustomEvent<any>) => void): () => void;
|
||||
$on(eventname: string, cb: (event: Event) => void): () => void;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue