fix delete tab subgrid
This commit is contained in:
@@ -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]
|
||||
})
|
||||
|
||||
@@ -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]
|
||||
}
|
||||
|
||||
@@ -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]
|
||||
}
|
||||
|
||||
@@ -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]
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user