Browse Source
adds an empty state if there is no datasource selected.
pull/1002/head
kevmodrome
6 years ago
No known key found for this signature in database
GPG Key ID: 828D8FE4D235B551
1 changed files with
20 additions and
5 deletions
-
packages/standard-components/src/List.svelte
|
|
|
@ -4,6 +4,7 @@ |
|
|
|
|
|
|
|
const { API, styleable, DataProvider } = getContext("sdk") |
|
|
|
const component = getContext("component") |
|
|
|
console.log($component) |
|
|
|
const dataContext = getContext("data") |
|
|
|
|
|
|
|
export let datasource = [] |
|
|
|
@ -24,9 +25,23 @@ |
|
|
|
</script> |
|
|
|
|
|
|
|
<div use:styleable={$component.styles}> |
|
|
|
{#each rows as row} |
|
|
|
<DataProvider {row}> |
|
|
|
<slot /> |
|
|
|
</DataProvider> |
|
|
|
{/each} |
|
|
|
{#if rows.length > 0} |
|
|
|
{#each rows as row} |
|
|
|
<DataProvider {row}> |
|
|
|
<slot /> |
|
|
|
</DataProvider> |
|
|
|
{/each} |
|
|
|
{:else} |
|
|
|
<p>Feed me some data</p> |
|
|
|
{/if} |
|
|
|
</div> |
|
|
|
|
|
|
|
<style> |
|
|
|
p { |
|
|
|
display: grid; |
|
|
|
place-items: center; |
|
|
|
background: #f5f5f5; |
|
|
|
border: #ccc 1px solid; |
|
|
|
padding: var(--spacing-m); |
|
|
|
} |
|
|
|
</style> |