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,6 +42,7 @@
|
|||
<LayoutIcon />
|
||||
</button>
|
||||
</li>
|
||||
{#if !component._component.startsWith('##')}
|
||||
<li>
|
||||
<button
|
||||
class:selected={current_view === 'code'}
|
||||
|
@ -61,9 +62,9 @@
|
|||
<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: "",
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
||||
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