enable collapsible nodes in component tree

This commit is contained in:
Martin McKeaveney 2021-10-21 16:24:58 +01:00
parent 8257d42701
commit 7882862a65
4 changed files with 30 additions and 4 deletions

View File

@ -11,6 +11,8 @@
export let level = 0 export let level = 0
export let dragDropStore export let dragDropStore
let closedNodes = {}
const selectComponent = component => { const selectComponent = component => {
store.actions.components.select(component) store.actions.components.select(component)
} }
@ -51,6 +53,15 @@
"component" "component"
return capitalise(type) return capitalise(type)
} }
function toggleNodeOpen(componentId) {
if (closedNodes[componentId]) {
delete closedNodes[componentId]
} else {
closedNodes[componentId] = true
}
closedNodes = closedNodes
}
</script> </script>
<ul> <ul>
@ -71,16 +82,18 @@
on:dragend={dragDropStore.actions.reset} on:dragend={dragDropStore.actions.reset}
on:dragstart={dragstart(component)} on:dragstart={dragstart(component)}
on:dragover={dragover(component, index)} on:dragover={dragover(component, index)}
on:iconClick={() => toggleNodeOpen(component._id)}
on:drop={dragDropStore.actions.drop} on:drop={dragDropStore.actions.drop}
text={getComponentText(component)} text={getComponentText(component)}
withArrow withArrow
indentLevel={level + 1} indentLevel={level + 1}
selected={$store.selectedComponentId === component._id} selected={$store.selectedComponentId === component._id}
opened={!closedNodes[component._id] && component?._children?.length}
> >
<ComponentDropdownMenu {component} /> <ComponentDropdownMenu {component} />
</NavItem> </NavItem>
{#if component._children} {#if component._children && !closedNodes[component._id]}
<svelte:self <svelte:self
components={component._children} components={component._children}
{currentComponent} {currentComponent}

View File

@ -37,7 +37,11 @@ interface RunConfig {
module External { module External {
const { makeExternalQuery } = require("./utils") const { makeExternalQuery } = require("./utils")
const { DataSourceOperation, FieldTypes, RelationshipTypes } = require("../../../constants") const {
DataSourceOperation,
FieldTypes,
RelationshipTypes,
} = require("../../../constants")
const { breakExternalTableId, isSQL } = require("../../../integrations/utils") const { breakExternalTableId, isSQL } = require("../../../integrations/utils")
const { processObjectSync } = require("@budibase/string-templates") const { processObjectSync } = require("@budibase/string-templates")
const { cloneDeep } = require("lodash/fp") const { cloneDeep } = require("lodash/fp")

View File

@ -201,7 +201,13 @@ function buildRead(knex: Knex, json: QueryJson, limit: number): KnexQuery {
[tableName]: query, [tableName]: query,
}).select(selectStatement) }).select(selectStatement)
// handle joins // handle joins
return addRelationships(knex, preQuery, selectStatement, tableName, relationships) return addRelationships(
knex,
preQuery,
selectStatement,
tableName,
relationships
)
} }
function buildUpdate( function buildUpdate(

View File

@ -34,7 +34,10 @@ export function generateRowIdField(keyProps: any[] = []) {
} }
export function isRowId(field: any) { export function isRowId(field: any) {
return Array.isArray(field) || (typeof field === "string" && field.match(ROW_ID_REGEX) != null) return (
Array.isArray(field) ||
(typeof field === "string" && field.match(ROW_ID_REGEX) != null)
)
} }
export function convertRowId(field: any) { export function convertRowId(field: any) {