fix delete tab subgrid

This commit is contained in:
Ruben Fiszel
2023-06-18 16:07:48 +02:00
parent 1d4afeeced
commit fd267cd70e
5 changed files with 7 additions and 9 deletions

View File

@@ -325,11 +325,10 @@ export function getAllSubgridsAndComponentIds(
export function deleteGridItem(
app: App,
component: AppComponent,
parent: string | undefined,
shouldKeepSubGrid: boolean
parent: string | undefined
): string[] {
let [subgrids, components] = getAllSubgridsAndComponentIds(app, component)
if (app.subgrids && !shouldKeepSubGrid) {
if (app.subgrids) {
subgrids.forEach((id) => {
delete app.subgrids![id]
})

View File

@@ -77,7 +77,7 @@
$selectedComponent = undefined
$focusedGrid = undefined
if (componentSettings?.item && !noGrid) {
let ids = deleteGridItem($app, componentSettings?.item.data, componentSettings?.parent, false)
let ids = deleteGridItem($app, componentSettings?.item.data, componentSettings?.parent)
for (const key of ids) {
delete $runnableComponents[key]
}

View File

@@ -79,7 +79,7 @@
function deleteSubgrid(index: number) {
let subgrid = `${component.id}-${index}`
for (const item of $app!.subgrids![subgrid]) {
const components = deleteGridItem($app, item.data, subgrid, false)
const components = deleteGridItem($app, item.data, subgrid)
for (const key in components) {
delete $runnableComponents[key]
}

View File

@@ -29,8 +29,7 @@
function deleteSubgrid(index: number) {
let subgrid = `${component.id}-${index}`
for (const item of $app!.subgrids![subgrid]) {
const components = deleteGridItem($app, item.data, subgrid, false)
console.log(components)
const components = deleteGridItem($app, item.data, subgrid)
for (const key in components) {
delete $runnableComponents[key]
}

View File

@@ -63,7 +63,7 @@
function deleteSubgrid(index: number) {
let subgrid = `${component.id}-${index}`
for (const item of $app!.subgrids![subgrid]) {
const components = deleteGridItem($app, item.data, subgrid, false)
const components = deleteGridItem($app, item.data, subgrid)
for (const key in components) {
delete $runnableComponents[key]
}
@@ -87,7 +87,7 @@
})
items = items
delete $app!.subgrids![items.length]
delete $app!.subgrids![`${component.id}-${items.length}`]
$app = $app
}