This commit is contained in:
Gerard Burns 2024-03-04 08:07:15 +00:00
parent 2f90d7f431
commit f1208919ee
5 changed files with 20 additions and 14 deletions

View File

@ -4,7 +4,7 @@
selectedScreen,
componentStore,
selectedComponent,
componentTreeNodesStore
componentTreeNodesStore,
} from "stores/builder"
import { findComponent } from "helpers/components"
import { goto, isActive } from "@roxi/routify"

View File

@ -8,7 +8,7 @@
userSelectedResourceMap,
selectedComponent,
hoverStore,
componentTreeNodesStore
componentTreeNodesStore,
} from "stores/builder"
import {
findComponentPath,

View File

@ -20,9 +20,11 @@ const expandNode = componentId => {
const expandNodes = componentIds => {
baseStore.update(openNodes => {
const newNodes = Object.fromEntries(componentIds.map(id => ([`nodeOpen-${id}`, true])))
const newNodes = Object.fromEntries(
componentIds.map(id => [`nodeOpen-${id}`, true])
)
return { ...openNodes, ...newNodes };
return { ...openNodes, ...newNodes }
})
}

View File

@ -19,7 +19,7 @@ import {
appStore,
previewStore,
tables,
componentTreeNodesStore
componentTreeNodesStore,
} from "stores/builder/index"
import { buildFormSchema, getSchemaForDatasource } from "dataBinding"
import {
@ -654,7 +654,9 @@ export class ComponentStore extends BudiStore {
state.selectedScreenId = targetScreenId
state.selectedComponentId = newComponentId
const targetScreen = get(screenStore).screens.find(screen => screen.id === targetScreenId)
const targetScreen = get(screenStore).screens.find(
screen => screen.id === targetScreenId
)
const componentPathIds = findComponentPath(
targetScreen?.props,
@ -814,7 +816,10 @@ export class ComponentStore extends BudiStore {
// sibling
const previousSibling = parent._children[index - 1]
const definition = this.getDefinition(previousSibling._component)
if (definition.hasChildren && componentTreeNodes[`nodeOpen-${previousSibling._id}`] !== false) {
if (
definition.hasChildren &&
componentTreeNodes[`nodeOpen-${previousSibling._id}`] !== false
) {
previousSibling._children.push(originalComponent)
}
@ -842,7 +847,6 @@ export class ComponentStore extends BudiStore {
const parent = findComponentParent(screen.props, componentId)
const componentTreeNodes = get(componentTreeNodesStore)
// Sanity check parent is found
if (!parent?._children?.length) {
return false
@ -868,7 +872,10 @@ export class ComponentStore extends BudiStore {
// If the next sibling has children, and is not collapsed, become the first child
const nextSibling = parent._children[index]
const definition = this.getDefinition(nextSibling._component)
if (definition.hasChildren && componentTreeNodes[`nodeOpen-${nextSibling._id}`] !== false) {
if (
definition.hasChildren &&
componentTreeNodes[`nodeOpen-${nextSibling._id}`] !== false
) {
nextSibling._children.splice(0, 0, originalComponent)
}

View File

@ -1,9 +1,6 @@
import { layoutStore } from "./layouts.js"
import { appStore } from "./app.js"
import {
componentStore,
selectedComponent,
} from "./components"
import { componentStore, selectedComponent } from "./components"
import { navigationStore } from "./navigation.js"
import { themeStore } from "./theme.js"
import { screenStore, selectedScreen, sortedScreens } from "./screens.js"
@ -29,7 +26,7 @@ import { integrations } from "./integrations"
import { sortedIntegrations } from "./sortedIntegrations"
import { queries } from "./queries"
import { flags } from "./flags"
import componentTreeNodesStore from './componentTreeNodes';
import componentTreeNodesStore from "./componentTreeNodes"
export {
componentTreeNodesStore,