Merge branch 'master' of github.com:Budibase/budibase
This commit is contained in:
commit
0762ab1522
|
@ -758,6 +758,8 @@ const addChildComponent = store => (componentToAdd, presetName) => {
|
||||||
state.currentFrontEndType === "page"
|
state.currentFrontEndType === "page"
|
||||||
? _savePage(state)
|
? _savePage(state)
|
||||||
: _saveScreenApi(state.currentPreviewItem, state)
|
: _saveScreenApi(state.currentPreviewItem, state)
|
||||||
|
|
||||||
|
state.currentComponentInfo = newComponent.props
|
||||||
|
|
||||||
return state
|
return state
|
||||||
})
|
})
|
||||||
|
@ -782,24 +784,24 @@ const addTemplatedComponent = store => props => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const selectComponent = store => component => {
|
const selectComponent = store => component => {
|
||||||
store.update(s => {
|
store.update(state => {
|
||||||
const componentDef = component._component.startsWith("##")
|
const componentDef = component._component.startsWith("##")
|
||||||
? component
|
? component
|
||||||
: s.components.find(c => c.name === component._component)
|
: state.components.find(c => c.name === component._component)
|
||||||
s.currentComponentInfo = makePropsSafe(componentDef, component)
|
state.currentComponentInfo = makePropsSafe(componentDef, component)
|
||||||
return s
|
return state
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const setComponentProp = store => (name, value) => {
|
const setComponentProp = store => (name, value) => {
|
||||||
store.update(s => {
|
store.update(state => {
|
||||||
const current_component = s.currentComponentInfo
|
const current_component = state.currentComponentInfo
|
||||||
s.currentComponentInfo[name] = value
|
state.currentComponentInfo[name] = value
|
||||||
|
|
||||||
_saveCurrentPreviewItem(s)
|
_saveCurrentPreviewItem(state)
|
||||||
|
|
||||||
s.currentComponentInfo = current_component
|
state.currentComponentInfo = current_component
|
||||||
return s
|
return state
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,9 @@
|
||||||
import ConfirmDialog from "../common/ConfirmDialog.svelte"
|
import ConfirmDialog from "../common/ConfirmDialog.svelte"
|
||||||
import { getRecordNodes, getIndexNodes, getIndexSchema, pipe } from "../common/core"
|
import { getRecordNodes, getIndexNodes, getIndexSchema, pipe } from "../common/core"
|
||||||
|
|
||||||
|
|
||||||
|
export let toggleTab
|
||||||
|
|
||||||
let componentLibraries = []
|
let componentLibraries = []
|
||||||
let current_view = "text"
|
let current_view = "text"
|
||||||
let selectedComponent = null
|
let selectedComponent = null
|
||||||
|
@ -49,6 +52,7 @@
|
||||||
} else {
|
} else {
|
||||||
store.addChildComponent(component.name)
|
store.addChildComponent(component.name)
|
||||||
}
|
}
|
||||||
|
toggleTab();
|
||||||
}
|
}
|
||||||
|
|
||||||
const onTemplateChosen = template => {
|
const onTemplateChosen = template => {
|
||||||
|
|
|
@ -3,11 +3,16 @@
|
||||||
import ComponentPropertiesPanel from "./ComponentPropertiesPanel.svelte"
|
import ComponentPropertiesPanel from "./ComponentPropertiesPanel.svelte"
|
||||||
import ComponentSelectionList from "./ComponentSelectionList.svelte"
|
import ComponentSelectionList from "./ComponentSelectionList.svelte"
|
||||||
|
|
||||||
let selected = "properties"
|
const PROPERTIES_TAB = "properties";
|
||||||
|
const COMPONENT_SELECTION_TAB = "components";
|
||||||
|
|
||||||
|
let selected = PROPERTIES_TAB
|
||||||
|
|
||||||
const isSelected = tab => selected === tab
|
const isSelected = tab => selected === tab
|
||||||
|
|
||||||
const selectTab = tab => (selected = tab)
|
const selectTab = tab => (selected = tab)
|
||||||
|
|
||||||
|
const toggleTab = () => selected = selected === PROPERTIES_TAB ? COMPONENT_SELECTION_TAB : PROPERTIES_TAB;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="root">
|
<div class="root">
|
||||||
|
@ -15,26 +20,26 @@
|
||||||
<div class="switcher">
|
<div class="switcher">
|
||||||
|
|
||||||
<button
|
<button
|
||||||
class:selected={selected === 'properties'}
|
class:selected={selected === PROPERTIES_TAB}
|
||||||
on:click={() => selectTab('properties')}>
|
on:click={() => selectTab(PROPERTIES_TAB)}>
|
||||||
Properties
|
Properties
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
class:selected={selected === 'components'}
|
class:selected={selected === COMPONENT_SELECTION_TAB}
|
||||||
on:click={() => selectTab('components')}>
|
on:click={() => selectTab(COMPONENT_SELECTION_TAB)}>
|
||||||
Components
|
Components
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="panel">
|
<div class="panel">
|
||||||
{#if selected === 'properties'}
|
{#if selected === PROPERTIES_TAB}
|
||||||
<ComponentPropertiesPanel />
|
<ComponentPropertiesPanel {toggleTab} />
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{#if selected === 'components'}
|
{#if selected === COMPONENT_SELECTION_TAB}
|
||||||
<ComponentSelectionList />
|
<ComponentSelectionList {toggleTab} />
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -44,19 +44,17 @@
|
||||||
component.component.name === $store.currentPreviewItem.name
|
component.component.name === $store.currentPreviewItem.name
|
||||||
|
|
||||||
const confirmDeleteComponent = async component => {
|
const confirmDeleteComponent = async component => {
|
||||||
console.log(component)
|
|
||||||
componentToDelete = component
|
componentToDelete = component
|
||||||
// await tick()
|
// await tick()
|
||||||
confirmDeleteDialog.show()
|
confirmDeleteDialog.show()
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div
|
<div>
|
||||||
class="budibase__nav-item"
|
<div
|
||||||
class:selected={$store.currentComponentInfo._id === _layout.component.props._id}
|
class="budibase__nav-item"
|
||||||
on:click|stopPropagation={() => store.setScreenType('page')}>
|
class:selected={$store.currentComponentInfo._id === _layout.component.props._id}
|
||||||
|
on:click|stopPropagation={() => store.setScreenType('page')}>
|
||||||
<div class="component">
|
|
||||||
<span
|
<span
|
||||||
class="icon"
|
class="icon"
|
||||||
class:rotate={$store.currentPreviewItem.name !== _layout.title}>
|
class:rotate={$store.currentPreviewItem.name !== _layout.title}>
|
||||||
|
|
Loading…
Reference in New Issue