diff --git a/packages/bbui/src/Table/Table.svelte b/packages/bbui/src/Table/Table.svelte index 7745c3c407..958869b066 100644 --- a/packages/bbui/src/Table/Table.svelte +++ b/packages/bbui/src/Table/Table.svelte @@ -270,155 +270,157 @@ } -
- {#if !loaded} -
- -
- {:else} -
- {#if fields.length} -
- {#if showEditColumn} -
- {#if allowSelectRows} - - {:else} - Edit - {/if} -
- {/if} - {#each fields as field} -
sortBy(schema[field])} - > -
{getDisplayName(schema[field])}
- {#if schema[field]?.autocolumn} - - - - {/if} - {#if sortColumn === field} - - {/if} - {#if allowEditColumns && schema[field]?.editable !== false} - editColumn(e, field)} - > - - - {/if} -
- {/each} -
- {/if} - {#if sortedRows?.length} - {#each sortedRows as row, idx} -
+{#key fields?.length} +
+ {#if !loaded} +
+ +
+ {:else} +
+ {#if fields.length} +
{#if showEditColumn}
{ - toggleSelectRow(row) - e.stopPropagation() - }} + class:noBorderHeader={!showHeaderBorder} + class="spectrum-Table-headCell spectrum-Table-headCell--divider spectrum-Table-headCell--edit" > - selectedRow._id === row._id - ) !== -1} - onEdit={e => editRow(e, row)} - {allowSelectRows} - {allowEditRows} - /> + {#if allowSelectRows} + + {:else} + Edit + {/if}
{/if} {#each fields as field}
{ - if (!schema[field]?.preventSelectRow) { - dispatch("click", row) - toggleSelectRow(row) - } - }} + class="spectrum-Table-headCell" + class:noBorderHeader={!showHeaderBorder} + class:spectrum-Table-headCell--alignCenter={schema[field] + .align === "Center"} + class:spectrum-Table-headCell--alignRight={schema[field] + .align === "Right"} + class:is-sortable={schema[field].sortable !== false} + class:is-sorted-desc={sortColumn === field && + sortOrder === "Descending"} + class:is-sorted-asc={sortColumn === field && + sortOrder === "Ascending"} + on:click={() => sortBy(schema[field])} > - - - +
{getDisplayName(schema[field])}
+ {#if schema[field]?.autocolumn} + + + + {/if} + {#if sortColumn === field} + + {/if} + {#if allowEditColumns && schema[field]?.editable !== false} + editColumn(e, field)} + > + + + {/if}
{/each}
- {/each} - {:else} -
- {#if customPlaceholder} - - {:else} -
- - - -
{placeholderText}
+ {/if} + {#if sortedRows?.length} + {#each sortedRows as row, idx} +
+ {#if showEditColumn} +
{ + toggleSelectRow(row) + e.stopPropagation() + }} + > + selectedRow._id === row._id + ) !== -1} + onEdit={e => editRow(e, row)} + {allowSelectRows} + {allowEditRows} + /> +
+ {/if} + {#each fields as field} +
{ + if (!schema[field]?.preventSelectRow) { + dispatch("click", row) + toggleSelectRow(row) + } + }} + > + + + +
+ {/each}
- {/if} -
- {/if} -
- {/if} -
+ {/each} + {:else} +
+ {#if customPlaceholder} + + {:else} +
+ + + +
{placeholderText}
+
+ {/if} +
+ {/if} +
+ {/if} +
+{/key}