forked from tsai/budibase
30 changed files with 179 additions and 129 deletions
@ -1,25 +1,19 @@ |
|||
<script> |
|||
import { onMount, getContext, setContext } from "svelte" |
|||
import { getContext, setContext } from "svelte" |
|||
import { createDataContextStore } from "../store" |
|||
|
|||
export let row |
|||
|
|||
// Get current contexts |
|||
const dataContext = getContext("data") |
|||
const { id } = getContext("style") |
|||
const styles = getContext("style") |
|||
|
|||
// Clone current context to this context |
|||
const newDataContext = createDataContextStore($dataContext) |
|||
setContext("data", newDataContext) |
|||
|
|||
// Add additional layer to context |
|||
let loaded = false |
|||
onMount(() => { |
|||
newDataContext.actions.addContext(row, id) |
|||
loaded = true |
|||
}) |
|||
$: newDataContext.actions.addContext(row, $styles.id) |
|||
</script> |
|||
|
|||
{#if loaded} |
|||
<slot /> |
|||
{/if} |
|||
<slot /> |
|||
|
|||
@ -0,0 +1,12 @@ |
|||
import { writable } from "svelte/store" |
|||
|
|||
const createBuilderStore = () => { |
|||
const initialState = { |
|||
inBuilder: false, |
|||
page: null, |
|||
screen: null, |
|||
} |
|||
return writable(initialState) |
|||
} |
|||
|
|||
export const builderStore = createBuilderStore() |
|||
Loading…
Reference in new issue