Hide repeater placeholders when not running inside the builder or when the component hasn't been initialised fully
This commit is contained in:
parent
47dbd43116
commit
c71007e7f8
|
@ -5,6 +5,7 @@ import {
|
||||||
routeStore,
|
routeStore,
|
||||||
screenStore,
|
screenStore,
|
||||||
bindingStore,
|
bindingStore,
|
||||||
|
builderStore,
|
||||||
} from "./store"
|
} from "./store"
|
||||||
import { styleable } from "./utils/styleable"
|
import { styleable } from "./utils/styleable"
|
||||||
import { linkable } from "./utils/linkable"
|
import { linkable } from "./utils/linkable"
|
||||||
|
@ -16,6 +17,7 @@ export default {
|
||||||
notifications: notificationStore,
|
notifications: notificationStore,
|
||||||
routeStore,
|
routeStore,
|
||||||
screenStore,
|
screenStore,
|
||||||
|
builderStore,
|
||||||
styleable,
|
styleable,
|
||||||
linkable,
|
linkable,
|
||||||
DataProvider,
|
DataProvider,
|
||||||
|
|
|
@ -2,12 +2,13 @@
|
||||||
import { getContext } from "svelte"
|
import { getContext } from "svelte"
|
||||||
import { isEmpty } from "lodash/fp"
|
import { isEmpty } from "lodash/fp"
|
||||||
|
|
||||||
const { API, styleable, DataProvider } = getContext("sdk")
|
const { API, styleable, DataProvider, builderStore } = getContext("sdk")
|
||||||
const component = getContext("component")
|
const component = getContext("component")
|
||||||
|
|
||||||
export let datasource = []
|
export let datasource = []
|
||||||
|
|
||||||
let rows = []
|
let rows = []
|
||||||
|
let loaded = false
|
||||||
|
|
||||||
$: fetchData(datasource)
|
$: fetchData(datasource)
|
||||||
|
|
||||||
|
@ -15,21 +16,22 @@
|
||||||
if (!isEmpty(datasource)) {
|
if (!isEmpty(datasource)) {
|
||||||
rows = await API.fetchDatasource(datasource)
|
rows = await API.fetchDatasource(datasource)
|
||||||
}
|
}
|
||||||
|
loaded = true
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div use:styleable={$component.styles}>
|
<div use:styleable={$component.styles}>
|
||||||
{#if rows.length > 0}
|
{#if rows.length > 0}
|
||||||
{#each rows as row}
|
{#if $component.children === 0 && $builderStore.inBuilder}
|
||||||
<DataProvider {row}>
|
<p>Add some components too</p>
|
||||||
{#if $component.children === 0}
|
{:else}
|
||||||
<p>Add some components too.</p>
|
{#each rows as row}
|
||||||
{:else}
|
<DataProvider {row}>
|
||||||
<slot />
|
<slot />
|
||||||
{/if}
|
</DataProvider>
|
||||||
</DataProvider>
|
{/each}
|
||||||
{/each}
|
{/if}
|
||||||
{:else}
|
{:else if loaded && $builderStore.inBuilder}
|
||||||
<p>Feed me some data</p>
|
<p>Feed me some data</p>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue