Merge pull request #1002 from Budibase/feature/repeater-placeholder

Adds empty states to the repeater component
This commit is contained in:
Kevin Åberg Kultalahti 2021-01-22 10:13:18 +01:00 committed by GitHub
commit 497feb80d6
2 changed files with 24 additions and 6 deletions

View File

@ -29,7 +29,7 @@
$builderStore.previewType === "layout" || screenslotContext $builderStore.previewType === "layout" || screenslotContext
// Update component context // 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 // Gets the component constructor for the specified component
const getComponentConstructor = component => { const getComponentConstructor = component => {

View File

@ -24,9 +24,27 @@
</script> </script>
<div use:styleable={$component.styles}> <div use:styleable={$component.styles}>
{#each rows as row} {#if rows.length > 0}
<DataProvider {row}> {#each rows as row}
<slot /> <DataProvider {row}>
</DataProvider> {#if $component.children === 0}
{/each} <p>Add some components too.</p>
{:else}
<slot />
{/if}
</DataProvider>
{/each}
{:else}
<p>Feed me some data</p>
{/if}
</div> </div>
<style>
p {
display: grid;
place-items: center;
background: #f5f5f5;
border: #ccc 1px solid;
padding: var(--spacing-m);
}
</style>