Merge branch 'master' of github.com:Budibase/budibase into feature/self-hosting

This commit is contained in:
mike12345567 2020-12-09 18:01:38 +00:00
commit a94ce70cee
12 changed files with 70 additions and 129 deletions

View File

@ -83,17 +83,16 @@ export const getFrontendStore = () => {
}, },
}, },
screens: { screens: {
select: screenId => { select: async screenId => {
store.update(state => { store.update(state => {
const screens = get(allScreens) const screen = get(allScreens).find(screen => screen._id === screenId)
let selectedScreen = screens.find(screen => screen._id === screenId) if (!screen) return state
if (!selectedScreen) {
selectedScreen = screens[0]
}
state.currentFrontEndType = FrontendTypes.SCREEN state.currentFrontEndType = FrontendTypes.SCREEN
state.currentAssetId = selectedScreen._id state.currentAssetId = screenId
state.currentView = "detail" state.currentView = "detail"
state.selectedComponentId = selectedScreen.props._id state.selectedComponentId = screen.props?._id
return state return state
}) })
}, },
@ -147,6 +146,9 @@ export const getFrontendStore = () => {
`/api/screens/${screenToDelete._id}/${screenToDelete._rev}` `/api/screens/${screenToDelete._id}/${screenToDelete._rev}`
) )
) )
if (screenToDelete._id === state.currentAssetId) {
state.currentAssetId = ""
}
} }
return state return state
}) })
@ -171,8 +173,10 @@ export const getFrontendStore = () => {
const layout = store.actions.layouts.find(layoutId) const layout = store.actions.layouts.find(layoutId)
state.currentFrontEndType = FrontendTypes.LAYOUT state.currentFrontEndType = FrontendTypes.LAYOUT
state.currentView = "detail" state.currentView = "detail"
state.currentAssetId = layout._id state.currentAssetId = layout._id
state.selectedComponentId = layout.props._id state.selectedComponentId = layout.props?._id
return state return state
}) })
}, },
@ -197,7 +201,6 @@ export const getFrontendStore = () => {
} }
state.currentAssetId = json._id state.currentAssetId = json._id
state.selectedComponentId = json.props._id
return state return state
}) })
}, },

View File

@ -18,7 +18,7 @@ export default function(tables) {
}) })
} }
export const newRowUrl = table => sanitizeUrl(`/${table.name}/new`) export const newRowUrl = table => sanitizeUrl(`/${table.name}/new/row`)
export const NEW_ROW_TEMPLATE = "NEW_ROW_TEMPLATE" export const NEW_ROW_TEMPLATE = "NEW_ROW_TEMPLATE"
function generateTitleContainer(table) { function generateTitleContainer(table) {

View File

@ -15,8 +15,15 @@
$: screen = $allScreens.find(screen => screen._id === screenId) $: screen = $allScreens.find(screen => screen._id === screenId)
const deleteScreen = () => { const deleteScreen = () => {
store.actions.screens.delete(screen) try {
store.actions.routing.fetch() store.actions.screens.delete(screen)
store.actions.routing.fetch()
confirmDeleteDialog.hide()
$goto("../")
notifier.success("Deleted screen successfully.")
} catch (err) {
notifier.danger("Error deleting screen")
}
} }
</script> </script>

View File

@ -12,8 +12,6 @@
let propGroup = null let propGroup = null
let currentGroup let currentGroup
const getProperties = name => panelDefinition[name]
function onChange(category) { function onChange(category) {
selectedCategory = category selectedCategory = category
} }
@ -38,7 +36,7 @@
{#each propertyGroupNames as groupName} {#each propertyGroupNames as groupName}
<PropertyGroup <PropertyGroup
name={groupName} name={groupName}
properties={getProperties(groupName)} properties={panelDefinition[groupName]}
styleCategory={selectedCategory} styleCategory={selectedCategory}
{onStyleChanged} {onStyleChanged}
{componentDefinition} {componentDefinition}
@ -64,9 +62,6 @@
gap: var(--spacing-l); gap: var(--spacing-l);
} }
.design-view-state-categories {
}
.positioned-wrapper { .positioned-wrapper {
position: relative; position: relative;
display: flex; display: flex;

View File

@ -1,6 +1,7 @@
<script> <script>
import { onMount } from "svelte" import { onMount } from "svelte"
import FlatButton from "./FlatButton.svelte" import FlatButton from "./FlatButton.svelte"
export let buttonProps = [] export let buttonProps = []
export let isMultiSelect = false export let isMultiSelect = false
export let value = [] export let value = []

View File

@ -1,64 +0,0 @@
<script>
import { params, goto } from "@sveltech/routify"
import { store } from "builderStore"
const layouts = [
{
title: "Private",
id: "main",
},
{
title: "Public",
id: "unauthenticated",
},
]
if (!$store.currentAssetId) {
// refactor so the right layout is chosen
store.actions.layouts.select($params.layout)
}
const changeLayout = id => {
store.actions.layouts.select(id)
$goto(`./${id}/layout`)
}
</script>
<div class="root">
{#each layouts as { title, id }}
<button
class:active={id === $params.layout}
on:click={() => changeLayout(id)}>
{title}
</button>
{/each}
</div>
<style>
.root {
display: flex;
flex-direction: row;
}
button {
cursor: pointer;
padding: 0 var(--spacing-m);
height: 32px;
text-align: center;
background: var(--background);
color: var(--grey-7);
border-radius: 5px;
font-size: var(--font-size-xs);
font-weight: 500;
transition: all 0.3s;
text-rendering: optimizeLegibility;
border: none !important;
outline: none;
font-family: var(--font-sans);
}
.active {
background: var(--grey-2);
color: var(--ink);
}
</style>

View File

@ -22,16 +22,14 @@
export let onChange = () => {} export let onChange = () => {}
let temporaryBindableValue = value let temporaryBindableValue = value
let bindableProperties = []
let anchor
let dropdown
function handleClose() { function handleClose() {
handleChange(key, temporaryBindableValue) handleChange(key, temporaryBindableValue)
} }
let bindableProperties = []
let anchor
let dropdown
function getBindableProperties() { function getBindableProperties() {
// Get all bindableProperties // Get all bindableProperties
bindableProperties = fetchBindableProperties({ bindableProperties = fetchBindableProperties({
@ -77,7 +75,7 @@
: temp : temp
} }
//Incase the component has a different value key name // Incase the component has a different value key name
const handlevalueKey = value => const handlevalueKey = value =>
props.valueKey ? { [props.valueKey]: safeValue() } : { value: safeValue() } props.valueKey ? { [props.valueKey]: safeValue() } : { value: safeValue() }
</script> </script>
@ -94,7 +92,7 @@
{...props} {...props}
name={key} /> name={key} />
</div> </div>
{#if bindable && control === Input && !key.startsWith('_')} {#if bindable && !key.startsWith('_') && control === Input}
<div <div
class="icon" class="icon"
data-cy={`${key}-binding-button`} data-cy={`${key}-binding-button`}

View File

@ -310,15 +310,15 @@ export default {
}, },
{ {
label: "Link Color", label: "Link Color",
key: "color", key: "linkColor",
control: Input, control: Colorpicker,
placeholder: "Link Color", defaultValue: "#000",
}, },
{ {
label: "Hover Color", label: "Hover Color",
key: "linkHoverColor", key: "linkHoverColor",
control: Input, control: Colorpicker,
placeholder: "Hover Color", defaultValue: "#222",
}, },
{ {
label: "Image Height", label: "Image Height",
@ -385,15 +385,15 @@ export default {
}, },
{ {
label: "Link Color", label: "Link Color",
key: "color", key: "linkColor",
control: Input, control: Colorpicker,
placeholder: "Link Color", defaultValue: "#000",
}, },
{ {
label: "Hover Color", label: "Hover Color",
key: "linkHoverColor", key: "linkHoverColor",
control: Input, control: Colorpicker,
placeholder: "Hover Color", defaultValue: "#222",
}, },
{ {
label: "Card Width", label: "Card Width",

View File

@ -12,7 +12,6 @@
"icon": "./build/icons/512x512.png", "icon": "./build/icons/512x512.png",
"appId": "com.budibase.builder", "appId": "com.budibase.builder",
"productName": "Budibase Builder", "productName": "Budibase Builder",
"afterSign": "electron-builder-notarize",
"mac": { "mac": {
"icon": "./assets/icons/icon.icns", "icon": "./assets/icons/icon.icns",
"category": "public.app-category.developer-tools", "category": "public.app-category.developer-tools",
@ -87,6 +86,7 @@
"pouchdb-all-dbs": "^1.0.2", "pouchdb-all-dbs": "^1.0.2",
"pouchdb-replication-stream": "^1.2.9", "pouchdb-replication-stream": "^1.2.9",
"sanitize-s3-objectkey": "^0.0.1", "sanitize-s3-objectkey": "^0.0.1",
"server-destroy": "^1.0.1",
"svelte": "^3.30.0", "svelte": "^3.30.0",
"tar-fs": "^2.1.0", "tar-fs": "^2.1.0",
"to-json-schema": "^0.2.5", "to-json-schema": "^0.2.5",
@ -105,7 +105,6 @@
"jest": "^24.8.0", "jest": "^24.8.0",
"nodemon": "^2.0.4", "nodemon": "^2.0.4",
"pouchdb-adapter-memory": "^7.2.1", "pouchdb-adapter-memory": "^7.2.1",
"server-destroy": "^1.0.1",
"supertest": "^4.0.2" "supertest": "^4.0.2"
}, },
"jest": { "jest": {

View File

@ -234,8 +234,14 @@
"description": "string", "description": "string",
"linkText": "string", "linkText": "string",
"linkUrl": "string", "linkUrl": "string",
"color": "string", "linkColor": {
"linkHoverColor": "string", "type": "string",
"default": "#000"
},
"linkHoverColor": {
"type": "string",
"default": "#000"
},
"imageHeight": { "imageHeight": {
"type": "options", "type": "options",
"default": "20rem", "default": "20rem",
@ -274,8 +280,14 @@
"subtext": "string", "subtext": "string",
"linkText": "string", "linkText": "string",
"linkUrl": "string", "linkUrl": "string",
"color": "string", "linkColor": {
"linkHoverColor": "string", "type": "string",
"default": "#000"
},
"linkHoverColor": {
"type": "string",
"default": "#000"
},
"imageWidth": { "imageWidth": {
"type": "options", "type": "options",
"default": "8rem", "default": "8rem",

View File

@ -11,14 +11,12 @@
export let description = "" export let description = ""
export let linkText = "" export let linkText = ""
export let linkUrl export let linkUrl
export let color export let linkColor
export let linkHoverColor export let linkHoverColor
export let imageHeight export let imageHeight
export let cardWidth export let cardWidth
$: cssVariables = { $: cssVariables = {
color,
linkHoverColor,
imageHeight, imageHeight,
cardWidth, cardWidth,
} }
@ -29,12 +27,13 @@
<div <div
use:cssVars={cssVariables} use:cssVars={cssVariables}
class="container" class="container"
use:styleable={$component.styles}> use:styleable={$component.styles}
{#if showImage}<img class="image" src={imageUrl} alt="" />{/if} style="--cardWidth: {cardWidth}">
{#if showImage}<img style="--imageWidth: {imageWidth}; --imageHeight: {imageHeight}" class="image" src={imageUrl} alt="" />{/if}
<div class="content"> <div class="content">
<h2 class="heading">{heading}</h2> <h2 class="heading">{heading}</h2>
<h4 class="text">{description}</h4> <h4 class="text">{description}</h4>
<a href={linkUrl}>{linkText}</a> <a style="--linkColor: {linkColor}; --linkHoverColor: {linkHoverColor}" href={linkUrl}>{linkText}</a>
</div> </div>
</div> </div>
@ -75,7 +74,7 @@
a { a {
margin: 0.5rem 0; margin: 0.5rem 0;
text-decoration: none; text-decoration: none;
color: var(--color); color: var(--linkColor);
font-weight: 600; font-weight: 600;
} }

View File

@ -1,6 +1,5 @@
<script> <script>
import { getContext } from "svelte" import { getContext } from "svelte"
import { cssVars } from "./helpers"
const { styleable } = getContext("sdk") const { styleable } = getContext("sdk")
const component = getContext("component") const component = getContext("component")
@ -12,36 +11,28 @@
export let subtext = "" export let subtext = ""
export let linkText = "" export let linkText = ""
export let linkUrl export let linkUrl
export let color export let linkColor
export let linkHoverColor export let linkHoverColor
export let cardWidth export let cardWidth
export let imageWidth export let imageWidth
export let imageHeight export let imageHeight
$: cssVariables = {
color,
linkHoverColor,
imageWidth,
cardWidth,
imageHeight,
}
$: showImage = !!imageUrl $: showImage = !!imageUrl
</script> </script>
<div <div
use:cssVars={cssVariables} use:styleable={$component.styles}
class="container" class="container"
use:styleable={$component.styles}> style="--cardWidth: {cardWidth}">
{#if showImage}<img class="image" src={imageUrl} alt="" />{/if} {#if showImage}<img style="--imageWidth: {imageWidth}; --imageHeight: {imageHeight}" class="image" src={imageUrl} alt="" />{/if}
<div class="content"> <div class="content">
<main> <main>
<h2 class="heading">{heading}</h2> <h2 class="heading">{heading}</h2>
<p class="text">{description}</p> <p class="text">{description}</p>
</main> </main>
<footer> <footer >
<p class="subtext">{subtext}</p> <p class="subtext">{subtext}</p>
<a href={linkUrl}>{linkText}</a> <a style="--linkColor: {linkColor}; --linkHoverColor: {linkHoverColor}" href={linkUrl}>{linkText}</a>
</footer> </footer>
</div> </div>
</div> </div>
@ -97,7 +88,7 @@
a { a {
margin: 0.5rem 0 0 0; margin: 0.5rem 0 0 0;
text-decoration: none; text-decoration: none;
color: var(--color); color: var(--linkColor);
font-weight: 600; font-weight: 600;
font-size: 0.85rem; font-size: 0.85rem;
margin: 0; margin: 0;