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