linting
This commit is contained in:
parent
d1affc2586
commit
61f2746cf9
|
@ -284,6 +284,6 @@ export const buildContextTreeLookupMap = rootComponent => {
|
|||
export const getChildIdsForComponent = component => {
|
||||
return [
|
||||
component._id,
|
||||
...(component?._children ?? []).map(getChildIdsForComponent).flat(1)
|
||||
...(component?._children ?? []).map(getChildIdsForComponent).flat(1),
|
||||
]
|
||||
}
|
||||
|
|
|
@ -130,7 +130,6 @@
|
|||
loading = false
|
||||
error = event.error || "An unknown error occurred"
|
||||
} else if (type === "select-component" && data.id) {
|
||||
console.log("selecting");
|
||||
componentStore.select(data.id)
|
||||
componentTreeNodesStore.makeNodeVisible(data.id)
|
||||
} else if (type === "hover-component") {
|
||||
|
|
|
@ -63,7 +63,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
const isOpen = (component) => {
|
||||
const isOpen = component => {
|
||||
if (!component?._children?.length) {
|
||||
return false
|
||||
}
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
import { get } from 'svelte/store'
|
||||
import { get } from "svelte/store"
|
||||
import { createSessionStorageStore } from "@budibase/frontend-core"
|
||||
import { selectedScreen as selectedScreenStore } from "./screens"
|
||||
import {
|
||||
findComponentPath,
|
||||
} from "helpers/components"
|
||||
import { findComponentPath } from "helpers/components"
|
||||
|
||||
const baseStore = createSessionStorageStore("openNodes", {})
|
||||
|
||||
|
@ -35,15 +33,11 @@ const collapseNodes = componentIds => {
|
|||
})
|
||||
}
|
||||
|
||||
|
||||
// Will ensure all parents of a node are expanded so that it is visible in the tree
|
||||
const makeNodeVisible = componentId => {
|
||||
const selectedScreen = get(selectedScreenStore);
|
||||
const selectedScreen = get(selectedScreenStore)
|
||||
|
||||
const path = findComponentPath(
|
||||
selectedScreen.props,
|
||||
componentId
|
||||
)
|
||||
const path = findComponentPath(selectedScreen.props, componentId)
|
||||
|
||||
const componentIds = path.map(component => component._id)
|
||||
|
||||
|
@ -57,7 +51,7 @@ const makeNodeVisible = componentId => {
|
|||
}
|
||||
|
||||
const isNodeExpanded = componentId => {
|
||||
const openNodes = get(baseStore);
|
||||
const openNodes = get(baseStore)
|
||||
return !!openNodes[`nodeOpen-${componentId}`]
|
||||
}
|
||||
|
||||
|
@ -67,7 +61,7 @@ const store = {
|
|||
expandNodes,
|
||||
makeNodeVisible,
|
||||
collapseNodes,
|
||||
isNodeExpanded
|
||||
isNodeExpanded,
|
||||
}
|
||||
|
||||
export default store
|
||||
|
|
Loading…
Reference in New Issue