fix(data-table): export useStaticWidth prop

This commit is contained in:
Eric Y Liu 2021-07-05 12:31:17 -07:00
commit 676eedb1a0
4 changed files with 21 additions and 0 deletions

View file

@ -958,6 +958,7 @@ export interface DataTableCell {
| radio | <code>let</code> | No | <code>boolean</code> | <code>false</code> | Set to `true` for the radio selection variant | | radio | <code>let</code> | No | <code>boolean</code> | <code>false</code> | Set to `true` for the radio selection variant |
| batchSelection | <code>let</code> | No | <code>boolean</code> | <code>false</code> | Set to `true` to enable batch selection | | batchSelection | <code>let</code> | No | <code>boolean</code> | <code>false</code> | Set to `true` to enable batch selection |
| stickyHeader | <code>let</code> | No | <code>boolean</code> | <code>false</code> | Set to `true` to enable a sticky header | | stickyHeader | <code>let</code> | No | <code>boolean</code> | <code>false</code> | Set to `true` to enable a sticky header |
| useStaticWidth | <code>let</code> | No | <code>boolean</code> | <code>false</code> | Set to `true` to use static width |
### Slots ### Slots

View file

@ -2095,6 +2095,16 @@
"isFunction": false, "isFunction": false,
"constant": false, "constant": false,
"reactive": false "reactive": false
},
{
"name": "useStaticWidth",
"kind": "let",
"description": "Set to `true` to use static width",
"type": "boolean",
"value": "false",
"isFunction": false,
"constant": false,
"reactive": false
} }
], ],
"slots": [ "slots": [

View file

@ -91,6 +91,9 @@
/** Set to `true` to enable a sticky header */ /** Set to `true` to enable a sticky header */
export let stickyHeader = false; export let stickyHeader = false;
/** Set to `true` to use static width */
export let useStaticWidth = false;
import { createEventDispatcher, setContext } from "svelte"; import { createEventDispatcher, setContext } from "svelte";
import { writable, derived } from "svelte/store"; import { writable, derived } from "svelte/store";
import ChevronRight16 from "carbon-icons-svelte/lib/ChevronRight16/ChevronRight16.svelte"; import ChevronRight16 from "carbon-icons-svelte/lib/ChevronRight16/ChevronRight16.svelte";
@ -221,6 +224,7 @@
size="{size}" size="{size}"
stickyHeader="{stickyHeader}" stickyHeader="{stickyHeader}"
sortable="{sortable}" sortable="{sortable}"
useStaticWidth="{useStaticWidth}"
> >
<TableHead> <TableHead>
<TableRow> <TableRow>

View file

@ -129,6 +129,12 @@ export interface DataTableProps
* @default false * @default false
*/ */
stickyHeader?: boolean; stickyHeader?: boolean;
/**
* Set to `true` to use static width
* @default false
*/
useStaticWidth?: boolean;
} }
export default class DataTable extends SvelteComponentTyped< export default class DataTable extends SvelteComponentTyped<