fix subgrids final

This commit is contained in:
Ruben Fiszel
2023-02-24 11:59:28 +01:00
parent 9ad39b27b7
commit 464ce18862
2 changed files with 16 additions and 11 deletions

View File

@@ -10,14 +10,16 @@
export let gridItems: GridItem[]
</script>
{#each gridItems as gridItem (gridItem.data.id)}
{#if gridItem.data.id === $selectedComponent}
<ComponentPanel bind:gridItems bind:component={gridItem.data} />
{:else if gridItem.data.type === 'tablecomponent'}
<TablePanel bind:component={gridItem.data} />
{:else if gridItem.data.subGrids}
{#each gridItem.data.subGrids as subGrid}
<svelte:self bind:gridItems={subGrid} />
{/each}
{/if}
{/each}
{#if gridItems}
{#each gridItems as gridItem (gridItem.data.id)}
{#if gridItem.data.id === $selectedComponent}
<ComponentPanel bind:gridItems bind:component={gridItem.data} />
{:else if gridItem.data.type === 'tablecomponent'}
<TablePanel bind:component={gridItem.data} />
{:else if gridItem.data.subGrids}
{#each gridItem.data.subGrids as subGrid}
<svelte:self bind:gridItems={subGrid} />
{/each}
{/if}
{/each}
{/if}

View File

@@ -259,6 +259,9 @@ export function toKebabCase(text: string) {
}
export function findParent(root: GridItem[], id: string): GridItem | undefined {
if (!root) {
return undefined
}
for (const a of root) {
if (a.id === id) {
return a