diff --git a/packages/standard-components/src/table/Table.svelte b/packages/standard-components/src/table/Table.svelte index 02e3b4e96..51acf3c44 100644 --- a/packages/standard-components/src/table/Table.svelte +++ b/packages/standard-components/src/table/Table.svelte @@ -16,24 +16,19 @@ let sortColumn let sortOrder - $: styles = makeStyles($component.styles, rowCount) $: rows = dataProvider?.rows ?? [] + $: contentStyle = getContentStyle(rowCount, rows.length) $: sortedRows = sortRows(rows, sortColumn, sortOrder) $: loaded = dataProvider?.loaded ?? false $: schema = dataProvider?.schema ?? {} $: fields = getFields(schema, columns, showAutoColumns) - const makeStyles = (styles, rowCount) => { + const getContentStyle = (rowCount, dataCount) => { if (!rowCount) { - return styles - } - return { - ...styles, - normal: { - ...styles.normal, - height: `${37 + rowCount * 56}px`, - }, + return "" } + const actualCount = Math.min(rowCount, dataCount) + return `height: ${36 + actualCount * 56}px;` } const sortRows = (rows, sortColumn, sortOrder) => { @@ -80,59 +75,61 @@
| - - | - {/if} - {#each fields as field} - sortBy(field)}>
-
- {schema[field]?.name}
-
-
- |
- {/each}
- ||||
|---|---|---|---|---|---|
|
-
-
- |
+ + + | {/if} {#each fields as field} -
-
- sortBy(field)}>
+ |
+ {schema[field]?.name}
+
- |
+
{/each}
|---|