fix(DataTable): useStaticWidth title/description

Signed-off-by: Florian-Schoenherr <florian.schoenherr99@gmail.com>
This commit is contained in:
Florian-Schoenherr 2021-09-21 16:50:11 +02:00
commit 80202bfe66
3 changed files with 11 additions and 1 deletions

View file

@ -202,7 +202,7 @@
} }
</script> </script>
<TableContainer {...$$restProps}> <TableContainer useStaticWidth="{useStaticWidth}" {...$$restProps}>
{#if title || $$slots.title || description || $$slots.description} {#if title || $$slots.title || description || $$slots.description}
<div class:bx--data-table-header="{true}"> <div class:bx--data-table-header="{true}">
{#if title || $$slots.title} {#if title || $$slots.title}

View file

@ -7,10 +7,14 @@
/** 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;
</script> </script>
<div <div
class:bx--data-table-container="{true}" class:bx--data-table-container="{true}"
class:bx--data-table-container--static="{useStaticWidth}"
class:bx--data-table--max-width="{stickyHeader}" class:bx--data-table--max-width="{stickyHeader}"
{...$$restProps} {...$$restProps}
> >

View file

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