fix subgrids final2

This commit is contained in:
Ruben Fiszel
2023-02-24 13:11:06 +01:00
parent 464ce18862
commit f04d088a90
4 changed files with 7 additions and 16 deletions
@@ -46,6 +46,7 @@
}
$: $selectedComponent === id && selectedIndex >= 0 && onFocus()
$: console.log(subGrids)
</script>
<InputValue {id} input={configuration.tabs} bind:value={tabs} />
@@ -1,5 +1,5 @@
<script lang="ts">
import { createEventDispatcher, getContext } from 'svelte'
import { getContext } from 'svelte'
import type { AppEditorContext, GridItem } from '../types'
import ComponentPanel from './settingsPanel/ComponentPanel.svelte'
@@ -13,7 +13,7 @@
{#if gridItems}
{#each gridItems as gridItem (gridItem.data.id)}
{#if gridItem.data.id === $selectedComponent}
<ComponentPanel bind:gridItems bind:component={gridItem.data} />
<ComponentPanel {gridItems} bind:component={gridItem.data} />
{:else if gridItem.data.type === 'tablecomponent'}
<TablePanel bind:component={gridItem.data} />
{:else if gridItem.data.subGrids}
@@ -11,6 +11,7 @@
{#each component.actionButtons as actionButton (actionButton.id)}
{#if actionButton.id === $selectedComponent}
<ComponentPanel
gridItems={undefined}
rowColumns
bind:component={actionButton}
onDelete={() => {
@@ -32,7 +32,7 @@
export let component: AppComponent | undefined
export let rowColumns = false
export let gridItems: GridItem[] | undefined = undefined
export let gridItems: GridItem[] | undefined
export let onDelete: (() => void) | undefined = undefined
const { app, staticOutputs, runnableComponents, selectedComponent, worldStore, focusedGrid } =
@@ -65,10 +65,10 @@
function removeGridElement() {
$selectedComponent = undefined
$focusedGrid = undefined
if (component) {
deleteComponent(gridItems, component, $app, $staticOutputs, $runnableComponents)
}
gridItems = gridItems
$staticOutputs = $staticOutputs
$runnableComponents = $runnableComponents
@@ -111,18 +111,7 @@
<div class="flex flex-col w-full gap-2 my-2">
{#if component.componentInput.type === 'static'}
<StaticInputEditor
bind:componentInput={component.componentInput}
on:deleteArrayItem={(e) => {
if (component?.type === 'tabscomponent') {
const deletedIndex = e.detail.index
if (component.subGrids) {
component.subGrids.splice(deletedIndex, 1)
}
}
}}
/>
<StaticInputEditor bind:componentInput={component.componentInput} />
{:else if component.componentInput.type === 'template' && component.componentInput !== undefined}
<div class="py-1 min-h-[28px] rounded border border-1 border-gray-500">
<TemplateEditor fontSize={12} bind:code={component.componentInput.eval} {extraLib} />