mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-18 11:36:36 +00:00
feat(data-table): support rendering empty table header in skeleton
This commit is contained in:
parent
b19696b9f1
commit
fcf93bb8aa
3 changed files with 13 additions and 2 deletions
|
@ -1015,6 +1015,12 @@ In the following example, each row in the sortable data table has an overflow me
|
||||||
|
|
||||||
<DataTableSkeleton headers={[{ value: "Name" }, {value: "Protocol"}, {value:"Port"}, { value: "Rule"}]} rows={10} />
|
<DataTableSkeleton headers={[{ value: "Name" }, {value: "Protocol"}, {value:"Port"}, { value: "Rule"}]} rows={10} />
|
||||||
|
|
||||||
|
### Skeleton with empty header
|
||||||
|
|
||||||
|
Pass an object with `"empty"` set to `true` to render an empty table header column.
|
||||||
|
|
||||||
|
<DataTableSkeleton headers={[{ value: "Name" }, {value: "Protocol"}, {value:"Port"}, { value: "Rule"}, { empty: true }]} rows={10} />
|
||||||
|
|
||||||
### Skeleton without header, toolbar
|
### Skeleton without header, toolbar
|
||||||
|
|
||||||
<DataTableSkeleton showHeader={false} showToolbar={false} />
|
<DataTableSkeleton showHeader={false} showToolbar={false} />
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script>
|
<script>
|
||||||
/** @extends {"../DataTable/DataTable"} DataTableHeader */
|
/** @extends {"./DataTable"} DataTableHeader */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specify the number of columns
|
* Specify the number of columns
|
||||||
|
@ -77,7 +77,11 @@
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
{#each cols as col (col)}
|
{#each cols as col (col)}
|
||||||
<th>{values[col] || ""}</th>
|
{#if typeof values[col] === "object" && values[col].empty === true}
|
||||||
|
<th></th>
|
||||||
|
{:else}
|
||||||
|
<th>{values[col] || ""}</th>
|
||||||
|
{/if}
|
||||||
{/each}
|
{/each}
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|
|
@ -249,6 +249,7 @@
|
||||||
{ value: 'Protocol' },
|
{ value: 'Protocol' },
|
||||||
{ value: 'Port' },
|
{ value: 'Port' },
|
||||||
{ value: 'Rule' },
|
{ value: 'Rule' },
|
||||||
|
{ empty: true },
|
||||||
]}"
|
]}"
|
||||||
rows="{10}"
|
rows="{10}"
|
||||||
/>
|
/>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue