1
0
Fork 0
mirror of synced 2024-07-02 13:01:09 +12:00
budibase/packages/standard-components/src/List.svelte

29 lines
503 B
Svelte
Raw Normal View History

2020-06-03 10:26:06 +12:00
<script>
2020-11-19 00:24:01 +13:00
import { onMount } from "svelte"
import {
fetchDatasource,
2020-11-19 00:24:01 +13:00
styleable,
DataProvider,
} from "@budibase/component-sdk"
import { isEmpty } from "lodash/fp"
2020-06-03 10:26:06 +12:00
export let datasource = []
2020-11-19 00:24:01 +13:00
export let styles
2020-06-03 10:26:06 +12:00
2020-11-19 00:24:01 +13:00
let rows = []
2020-06-03 10:26:06 +12:00
onMount(async () => {
if (!isEmpty(datasource)) {
2020-11-19 00:24:01 +13:00
rows = await fetchDatasource(datasource)
2020-06-03 10:26:06 +12:00
}
})
</script>
2020-11-19 00:24:01 +13:00
<div use:styleable={styles}>
{#each rows as row}
<DataProvider {row}>
<slot />
</DataProvider>
{/each}
</div>