forked from tsai/budibase
30 changed files with 179 additions and 129 deletions
@ -1,25 +1,19 @@ |
|||||
<script> |
<script> |
||||
import { onMount, getContext, setContext } from "svelte" |
import { getContext, setContext } from "svelte" |
||||
import { createDataContextStore } from "../store" |
import { createDataContextStore } from "../store" |
||||
|
|
||||
export let row |
export let row |
||||
|
|
||||
// Get current contexts |
// Get current contexts |
||||
const dataContext = getContext("data") |
const dataContext = getContext("data") |
||||
const { id } = getContext("style") |
const styles = getContext("style") |
||||
|
|
||||
// Clone current context to this context |
// Clone current context to this context |
||||
const newDataContext = createDataContextStore($dataContext) |
const newDataContext = createDataContextStore($dataContext) |
||||
setContext("data", newDataContext) |
setContext("data", newDataContext) |
||||
|
|
||||
// Add additional layer to context |
// Add additional layer to context |
||||
let loaded = false |
$: newDataContext.actions.addContext(row, $styles.id) |
||||
onMount(() => { |
|
||||
newDataContext.actions.addContext(row, id) |
|
||||
loaded = true |
|
||||
}) |
|
||||
</script> |
</script> |
||||
|
|
||||
{#if loaded} |
<slot /> |
||||
<slot /> |
|
||||
{/if} |
|
||||
|
|||||
@ -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