Add screenslot to current preview.
This commit is contained in:
parent
6db4394562
commit
3c51f731ef
|
@ -182,6 +182,7 @@ const initialise = (store, initial) => async () => {
|
|||
}
|
||||
|
||||
store.set(initial)
|
||||
console.log(initial)
|
||||
return initial
|
||||
}
|
||||
|
||||
|
@ -743,6 +744,7 @@ const setCurrentPage = store => pageName => {
|
|||
})
|
||||
}
|
||||
|
||||
|
||||
const getContainerComponent = components =>
|
||||
components.find(c => c.name === "@budibase/standard-components/container")
|
||||
|
||||
|
@ -758,14 +760,16 @@ const addChildComponent = store => componentName => {
|
|||
)
|
||||
|
||||
_savePage(s)
|
||||
|
||||
//console.log(JSON.stringify(s.screens[0].props._children))
|
||||
return s
|
||||
})
|
||||
}
|
||||
|
||||
const selectComponent = store => component => {
|
||||
store.update(s => {
|
||||
const componentDef = s.components.find(c => c.name === component._component)
|
||||
const componentDef = component._component.startsWith("##")
|
||||
? component
|
||||
: s.components.find(c => c.name === component._component)
|
||||
s.currentComponentInfo = makePropsSafe(componentDef, component)
|
||||
return s
|
||||
})
|
||||
|
|
|
@ -42,28 +42,29 @@
|
|||
<LayoutIcon />
|
||||
</button>
|
||||
</li>
|
||||
<li>
|
||||
<button
|
||||
class:selected={current_view === 'code'}
|
||||
on:click={() => codeEditor && codeEditor.show()}>
|
||||
{#if component._code && component._code.trim().length > 0}
|
||||
<div class="button-indicator">
|
||||
<CircleIndicator />
|
||||
</div>
|
||||
{/if}
|
||||
<TerminalIcon />
|
||||
</button>
|
||||
</li>
|
||||
<li>
|
||||
<button
|
||||
class:selected={current_view === 'events'}
|
||||
on:click={() => (current_view = 'events')}>
|
||||
<EventsIcon />
|
||||
</button>
|
||||
</li>
|
||||
{#if !component._component.startsWith('##')}
|
||||
<li>
|
||||
<button
|
||||
class:selected={current_view === 'code'}
|
||||
on:click={() => codeEditor && codeEditor.show()}>
|
||||
{#if component._code && component._code.trim().length > 0}
|
||||
<div class="button-indicator">
|
||||
<CircleIndicator />
|
||||
</div>
|
||||
{/if}
|
||||
<TerminalIcon />
|
||||
</button>
|
||||
</li>
|
||||
<li>
|
||||
<button
|
||||
class:selected={current_view === 'events'}
|
||||
on:click={() => (current_view = 'events')}>
|
||||
<EventsIcon />
|
||||
</button>
|
||||
</li>
|
||||
{/if}
|
||||
</ul>
|
||||
{$store.currentFrontEndType}
|
||||
|
||||
<div class="component-props-container">
|
||||
|
||||
{#if current_view === 'props'}
|
||||
|
@ -81,8 +82,6 @@
|
|||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<style>
|
||||
|
|
|
@ -32,7 +32,37 @@
|
|||
$: frontendDefinition = {
|
||||
componentLibraries: $store.loadLibraryUrls(),
|
||||
page: $store.currentPreviewItem,
|
||||
screens: [],
|
||||
screens: [{
|
||||
name: "Screen Placeholder",
|
||||
route: "*",
|
||||
props: {
|
||||
_component: "@budibase/standard-components/container",
|
||||
type: "div",
|
||||
_children: [
|
||||
{
|
||||
_component: "@budibase/standard-components/container",
|
||||
_styles: { "position": {},"layout": {} },
|
||||
_id: "__screenslot__text",
|
||||
_code: "",
|
||||
className: "",
|
||||
onLoad: [],
|
||||
type: "div",
|
||||
_children: [{
|
||||
_component:"@budibase/standard-components/text",
|
||||
_styles: { "position": {}, "layout": {} },
|
||||
_id: "__screenslot__text",
|
||||
_code: "",
|
||||
text: "content",
|
||||
font: "",
|
||||
color: "",
|
||||
textAlign: "inline",
|
||||
verticalAlign: "inline",
|
||||
formattingTag: "none"
|
||||
}]
|
||||
}
|
||||
]
|
||||
}
|
||||
}],
|
||||
appRootPath: "",
|
||||
}
|
||||
|
||||
|
@ -92,4 +122,4 @@
|
|||
top: 0;
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
let modalOpen = false
|
||||
let events = []
|
||||
let selectedEvent = null
|
||||
|
||||
$: console.log(component)
|
||||
|
||||
$: {
|
||||
events = Object.keys(component)
|
||||
|
@ -42,8 +42,9 @@
|
|||
|
||||
function findType(propName) {
|
||||
if (!component._component) return
|
||||
return components.find(({ name }) => name === component._component)
|
||||
.props[propName]
|
||||
return components.find(({ name }) => name === component._component).props[
|
||||
propName
|
||||
]
|
||||
}
|
||||
|
||||
const openModal = event => {
|
||||
|
|
|
@ -9,6 +9,7 @@ export const screenRouter = (screens, onScreenSelected) => {
|
|||
let current
|
||||
|
||||
function route(url) {
|
||||
|
||||
const _url = url.state || url
|
||||
current = routes.findIndex(
|
||||
p => p !== "*" && new RegExp("^" + p + "$").test(_url)
|
||||
|
@ -42,7 +43,11 @@ export const screenRouter = (screens, onScreenSelected) => {
|
|||
onScreenSelected(screens[fallback], store, _url)
|
||||
}
|
||||
|
||||
!url.state && history.pushState(_url, null, _url)
|
||||
try {
|
||||
!url.state && history.pushState(_url, null, _url)
|
||||
} catch (_) {
|
||||
// ignoring an exception here as the builder runs an iframe, which does not like this
|
||||
}
|
||||
}
|
||||
|
||||
function click(e) {
|
||||
|
|
|
@ -34,7 +34,8 @@
|
|||
return all
|
||||
}
|
||||
|
||||
$: if(_bb.props._children.length > 0) theButton && _bb.attachChildren(theButton)
|
||||
$: if (_bb.props._children.length > 0)
|
||||
theButton && _bb.attachChildren(theButton)
|
||||
|
||||
$: {
|
||||
cssVariables = {
|
||||
|
@ -73,7 +74,7 @@
|
|||
disabled={disabled || false}
|
||||
on:click={clickHandler}
|
||||
style={buttonStyles}>
|
||||
{#if _bb.props_children.length === 0}{contentText}{/if}
|
||||
{#if _bb.props._children.length === 0}{contentText}{/if}
|
||||
</button>
|
||||
|
||||
<style>
|
||||
|
|
Loading…
Reference in New Issue