diff --git a/packages/standard-components/manifest.json b/packages/standard-components/manifest.json index e35a3c8caa..5c110d2d12 100644 --- a/packages/standard-components/manifest.json +++ b/packages/standard-components/manifest.json @@ -1533,6 +1533,12 @@ "key": "showAutoColumns", "defaultValue": false }, + { + "type": "number", + "label": "Row Count", + "key": "rowCount", + "defaultValue": 8 + }, { "type": "select", "label": "Theme", diff --git a/packages/standard-components/src/table/Table.svelte b/packages/standard-components/src/table/Table.svelte index 8df8c06e34..24eb2d121f 100644 --- a/packages/standard-components/src/table/Table.svelte +++ b/packages/standard-components/src/table/Table.svelte @@ -8,7 +8,7 @@ export let dataProvider export let columns export let showAutoColumns - export let rowCount = 8 + export let rowCount const component = getContext("component") const { styleable } = getContext("sdk") @@ -16,12 +16,26 @@ let sortColumn let sortOrder + $: styles = makeStyles($component.styles, rowCount) $: rows = dataProvider?.rows ?? [] $: sortedRows = sortRows(rows, sortColumn, sortOrder) $: loaded = dataProvider?.loaded ?? false $: schema = dataProvider?.schema ?? {} $: fields = getFields(schema, columns, showAutoColumns) + const makeStyles = (styles, rowCount) => { + if (!rowCount) { + return styles + } + return { + ...styles, + normal: { + ...styles.normal, + height: `${37 + rowCount * 56}px`, + }, + } + } + const sortRows = (rows, sortColumn, sortOrder) => { if (!sortColumn || !sortOrder) { return rows @@ -52,7 +66,6 @@ } let columns = [] Object.entries(schema).forEach(([field, fieldSchema]) => { - console.log(fieldSchema) if (showAutoColumns || !fieldSchema?.autocolumn) { columns.push(field) } @@ -61,50 +74,48 @@ } -
sortBy(field)}>
+
+ {schema[field]?.name}
+
+
+ |
+ {/each}
+ |
---|---|
sortBy(field)}>
-
- {schema[field]?.name}
-
+
+ |
+
- |
+
{/each}
-
-
- |
- {/each}
-