Browse Source
Merge pull request #1002 from Budibase/feature/repeater-placeholder
Adds empty states to the repeater component
gh-pages
Kevin Åberg Kultalahti
6 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
24 additions and
6 deletions
-
packages/client/src/components/Component.svelte
-
packages/standard-components/src/List.svelte
|
|
|
@ -29,7 +29,7 @@ |
|
|
|
$builderStore.previewType === "layout" || screenslotContext |
|
|
|
|
|
|
|
// Update component context |
|
|
|
$: componentStore.set({ id, styles: { ...styles, id, allowSelection } }) |
|
|
|
$: componentStore.set({ id, children: children.length, styles: { ...styles, id, allowSelection } }) |
|
|
|
|
|
|
|
// Gets the component constructor for the specified component |
|
|
|
const getComponentConstructor = component => { |
|
|
|
|
|
|
|
@ -24,9 +24,27 @@ |
|
|
|
</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}> |
|
|
|
{#if $component.children === 0} |
|
|
|
<p>Add some components too.</p> |
|
|
|
{:else} |
|
|
|
<slot /> |
|
|
|
{/if} |
|
|
|
</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> |