Testing Complete - Resolve Post Issue

This commit is contained in:
Conor_Mack 2020-05-18 16:32:00 +01:00
parent baec9f50d9
commit 5b8d1cead7
15 changed files with 294 additions and 215 deletions

View File

@ -110,33 +110,36 @@ const object_to_css_string = [
join_with("\n"), join_with("\n"),
] ]
export const generate_css = ({ layout, position }) => { export const generate_css = style => {
let _layout = pipe(layout, object_to_css_string) // let cssString = pipe(style, object_to_css_string)
if (_layout.length) { let cssString = Object.entries(style).reduce((str, [key, value]) => {
_layout += `\ndisplay: ${_layout.includes("flex") ? "flex" : "grid"};` //TODO Handle arrays and objects here also
} if (typeof value === "string") {
if (value) {
return (str += `${key}: ${value};\n`)
}
} else if (Array.isArray(value)) {
return (str += `${key}: ${value.map(v => `${v}px`).join(" ")};\n`)
}
}, "")
return { return (cssString || "").trim()
layout: _layout,
position: pipe(position, object_to_css_string),
}
} }
const apply_class = (id, name, styles) => `.${name}-${id} {\n${styles}\n}` const apply_class = (id, name, styles) => `.${name}-${id} {\n${styles}\n}`
export const generate_screen_css = component_array => { export const generate_screen_css = component_array => {
let styles = "" let styles = ""
let emptyStyles = { layout: {}, position: {} } let emptyStyles = {}
for (let i = 0; i < component_array.length; i += 1) { for (let i = 0; i < component_array.length; i += 1) {
const { _styles, _id, _children } = component_array[i] const { _styles, _id, _children } = component_array[i]
const { layout, position } = generate_css(_styles || emptyStyles) const cssString = generate_css(_styles || emptyStyles) || ""
if (cssString) {
styles += apply_class(_id, "pos", position) + "\n" styles += apply_class(_id, "element", cssString)
styles += apply_class(_id, "lay", layout) + "\n" }
if (_children && _children.length) { if (_children && _children.length) {
styles += generate_screen_css(_children) + "\n" styles += generate_screen_css(_children) + "\n"
} }
} }
return styles.trim() return styles.trim()
} }

View File

@ -140,10 +140,12 @@ const _saveScreen = async (store, s, screen) => {
return s return s
} }
const _saveScreenApi = (screen, s) => const _saveScreenApi = (screen, s) => {
api api
.post(`/_builder/api/${s.appId}/pages/${s.currentPageName}/screen`, screen) .post(`/_builder/api/${s.appId}/pages/${s.currentPageName}/screen`, screen)
.then(() => _savePage(s)) .then(() => _savePage(s))
}
const createScreen = store => (screenName, route, layoutComponentName) => { const createScreen = store => (screenName, route, layoutComponentName) => {
store.update(state => { store.update(state => {
@ -278,7 +280,6 @@ const removeStylesheet = store => stylesheet => {
const _savePage = async s => { const _savePage = async s => {
const page = s.pages[s.currentPageName] const page = s.pages[s.currentPageName]
await api.post(`/_builder/api/${s.appId}/pages/${s.currentPageName}`, { await api.post(`/_builder/api/${s.appId}/pages/${s.currentPageName}`, {
page: { componentLibraries: s.pages.componentLibraries, ...page }, page: { componentLibraries: s.pages.componentLibraries, ...page },
uiFunctions: s.currentPageFunctions, uiFunctions: s.currentPageFunctions,
@ -426,7 +427,9 @@ const setComponentStyle = store => (type, name, value) => {
if (!state.currentComponentInfo._styles) { if (!state.currentComponentInfo._styles) {
state.currentComponentInfo._styles = {} state.currentComponentInfo._styles = {}
} }
state.currentComponentInfo._styles[type][name] = value // state.currentComponentInfo._styles[type][name] = value
state.currentComponentInfo._styles[name] = value
state.currentPreviewItem._css = generate_screen_css([ state.currentPreviewItem._css = generate_screen_css([
state.currentPreviewItem.props, state.currentPreviewItem.props,
]) ])

View File

@ -2,36 +2,50 @@
import { onMount } from "svelte" import { onMount } from "svelte"
export let meta = [] export let meta = []
export let size = "" export let label = ""
export let values = [] export let values = []
export let type = "number" export let type = "number"
export let onStyleChanged = () => {} export let onChange = () => {}
let _values = values.map(v => v) let _values = values.map(v => v)
$: onStyleChanged(_values) // $: onChange(_values)
</script> </script>
<div class="inputs {size}"> <div class="input-container">
{#each meta as { placeholder }, i} <div class="label">{label}</div>
<input <div class="inputs">
{type} {#each meta as { placeholder }, i}
{placeholder} <input
value={values[i]} {type}
on:input={e => (_values[i] = e.target.value)} /> placeholder={placeholder || ''}
{/each} value={values[i]}
on:input={e => (_values[i] = e.target.value)} />
{/each}
</div>
</div> </div>
<style> <style>
.inputs { .input-container {
display: flex; display: flex;
justify-content: space-between; }
.label {
flex: 0;
}
.inputs {
flex: 1;
/* display: flex;
justify-content: space-between; */
} }
input { input {
width: 83px; width: 40px;
height: 32px;
font-size: 13px; font-size: 13px;
font-weight: 700; font-weight: 700;
margin: 0px 5px;
color: #163057; color: #163057;
opacity: 0.7; opacity: 0.7;
padding: 5px 10px; padding: 5px 10px;
@ -49,17 +63,11 @@
margin: 0; margin: 0;
} }
.small > input { input[type="number"] {
width: 38px; -moz-appearance: textfield;
height: 38px;
display: flex;
justify-content: center;
align-items: center;
text-align: center;
padding: 0;
} }
.small > input::placeholder { input::placeholder {
text-align: center; text-align: center;
} }
</style> </style>

View File

@ -60,7 +60,7 @@
_children: [ _children: [
{ {
_component: "@budibase/standard-components/container", _component: "@budibase/standard-components/container",
_styles: { position: {}, layout: {} }, _styles: {},
_id: "__screenslot__text", _id: "__screenslot__text",
_code: "", _code: "",
className: "", className: "",
@ -69,7 +69,7 @@
_children: [ _children: [
{ {
_component: "@budibase/standard-components/text", _component: "@budibase/standard-components/text",
_styles: { position: {}, layout: {} }, _styles: {},
_id: "__screenslot__text_2", _id: "__screenslot__text_2",
_code: "", _code: "",
text: "content", text: "content",

View File

@ -11,7 +11,7 @@ export default ({
<style> <style>
${styles || ""} ${styles || ""}
.pos-${selectedComponentId} { .element-${selectedComponentId} {
border: 2px solid #0055ff; border: 2px solid #0055ff;
} }

View File

@ -1,4 +1,5 @@
<script> <script>
import { setContext, onMount } from "svelte"
import PropsView from "./PropsView.svelte" import PropsView from "./PropsView.svelte"
import { store } from "builderStore" import { store } from "builderStore"
import IconButton from "components/common/IconButton.svelte" import IconButton from "components/common/IconButton.svelte"
@ -16,27 +17,28 @@
import panelStructure from "./temporaryPanelStructure.js" import panelStructure from "./temporaryPanelStructure.js"
import CategoryTab from "./CategoryTab.svelte" import CategoryTab from "./CategoryTab.svelte"
import DesignView from "./DesignView.svelte" import DesignView from "./DesignView.svelte"
import SettingsView from "./SettingsView.svelte"
let current_view = "design" let current_view = "design"
let codeEditor let codeEditor
let flattenedPanel = flattenComponents(panelStructure.categories) let flattenedPanel = flattenComponents(panelStructure.categories)
let categories = [ let categories = [
{ name: "Design" }, { value: "design", name: "Design" },
{ name: "Settings" }, { value: "settings", name: "Settings" },
{ name: "Actions" }, { value: "actions", name: "Actions" },
] ]
let selectedCategory = categories[0] let selectedCategory = categories[0]
$: components = $store.components $: components = $store.components
$: componentInstance = $store.currentComponentInfo $: componentInstance = $store.currentComponentInfo
$: componentDefinition = $store.components.find( $: componentDefinition = $store.components[componentInstance._component]
c => c.name === componentInstance._component $: componentPropDefinition = flattenedPanel.find(
)
$: panelDefinition = flattenedPanel.find(
//use for getting controls for each component property //use for getting controls for each component property
c => c._component === componentInstance._component c => c._component === componentInstance._component
) )
$: panelDefinition = componentPropDefinition
? componentPropDefinition.properties[selectedCategory.value]
: {}
// SCREEN PROPS ============================================= // SCREEN PROPS =============================================
$: screen_props = $: screen_props =
@ -44,8 +46,11 @@
? getProps($store.currentPreviewItem, ["name", "favicon"]) ? getProps($store.currentPreviewItem, ["name", "favicon"])
: getProps($store.currentPreviewItem, ["name", "description", "route"]) : getProps($store.currentPreviewItem, ["name", "description", "route"])
// const onStyleChanged = store.setComponentStyle
// const onStyleChanged = store.onStyleChanged
const onStyleChanged = store.setComponentStyle const onStyleChanged = store.setComponentStyle
const onPropChanged = store.onPropChanged const onPropChanged = store.setComponentProp
function walkProps(component, action) { function walkProps(component, action) {
action(component) action(component)
@ -81,12 +86,17 @@
{selectedCategory} /> {selectedCategory} />
<div class="component-props-container"> <div class="component-props-container">
{#if current_view === 'design'} {#if selectedCategory.value === 'design'}
<DesignView <DesignView
{panelDefinition} {panelDefinition}
{componentInstance} {componentInstance}
{componentDefinition} {componentDefinition}
{onPropChanged} /> {onStyleChanged} />
{:else if selectedCategory.value === 'settings'}
<SettingsView
{componentInstance}
{panelDefinition}
onChange={onPropChanged} />
{/if} {/if}
</div> </div>

View File

@ -5,11 +5,11 @@
export let panelDefinition = {} export let panelDefinition = {}
export let componentInstance = {} export let componentInstance = {}
export let componentDefinition = {} export let componentDefinition = {}
export let onPropChanged = () => {} export let onStyleChanged = () => {}
let selectedCategory = "desktop" let selectedCategory = "desktop"
const getProperties = name => panelDefinition.properties[name] const getProperties = name => panelDefinition[name]
function onChange(category) { function onChange(category) {
selectedCategory = category selectedCategory = category
@ -23,8 +23,7 @@
{ value: "selected", text: "Selected" }, { value: "selected", text: "Selected" },
] ]
$: propertyGroupNames = $: propertyGroupNames = Object.keys(panelDefinition)
!!panelDefinition.properties && Object.keys(panelDefinition.properties)
</script> </script>
<div class="design-view-container"> <div class="design-view-container">
@ -38,7 +37,7 @@
<PropertyGroup <PropertyGroup
name={groupName} name={groupName}
properties={getProperties(groupName)} properties={getProperties(groupName)}
{onPropChanged} {onStyleChanged}
{componentDefinition} {componentDefinition}
{componentInstance} /> {componentInstance} />
{/each} {/each}

View File

@ -1,4 +1,6 @@
<script> <script>
import { onMount, getContext } from "svelte"
export let label = "" export let label = ""
export let control = null export let control = null
export let value = "" export let value = ""

View File

@ -3,10 +3,10 @@
import PropertyControl from "./PropertyControl.svelte" import PropertyControl from "./PropertyControl.svelte"
export let name = "" export let name = ""
export let properties = {} export let properties = []
export let componentInstance = {} export let componentInstance = {}
export let componentDefinition = {} export let componentDefinition = {}
export let onPropChanged = () => {} export let onStyleChanged = () => {}
export let show = false export let show = false
let showComponentGroup = false let showComponentGroup = false
@ -15,7 +15,10 @@
const capitalize = name => name[0].toUpperCase() + name.slice(1) const capitalize = name => name[0].toUpperCase() + name.slice(1)
function onChange(key, v) { function onChange(key, v) {
!!v.target ? onPropChanged(key, v.target.value) : onPropChanged(key, v) console.log("PROPERTY GROUP ON CHANGE")
!!v.target
? onStyleChanged(name, key, v.target.value)
: onStyleChanged(name, key, v)
} }
$: { $: {
@ -29,7 +32,6 @@
} }
} }
$: propertyDefinition = Object.entries(properties)
$: icon = show ? "ri-arrow-down-s-fill" : "ri-arrow-right-s-fill" $: icon = show ? "ri-arrow-down-s-fill" : "ri-arrow-right-s-fill"
</script> </script>
@ -43,14 +45,14 @@
</div> </div>
<div class="property-panel" class:show> <div class="property-panel" class:show>
{#each propertyDefinition as [key, definition]} {#each properties as props}
<!-- {#if propExistsOnComponentDef(key)} --> <!-- {#if propExistsOnComponentDef(key)} -->
<PropertyControl <PropertyControl
label={definition.label || capitalize(key)} label={props.label}
control={definition.control} control={props.control}
value={componentInstance[key]} value={componentInstance[props.cssKey]}
onChange={value => onChange(key, value)} onChange={value => onChange(props.cssKey, value)}
props={{ ...excludeProps(definition, ['control']) }} /> props={{ ...excludeProps(props, ['control']) }} />
<!-- {/if} --> <!-- {/if} -->
{/each} {/each}
</div> </div>

View File

@ -0,0 +1,35 @@
<script>
import PropertyControl from "./PropertyControl.svelte"
import InputGroup from "../common/Inputs/InputGroup.svelte"
import { excludeProps } from "./propertyCategories.js"
export let panelDefinition = {}
export let componentInstance = {}
export let onChange = () => {}
function handleChange(key, data) {
data.target ? onChange(key, data.target.value) : onChange(key, data)
}
const meta = [
{ placeholder: "T" },
{ placeholder: "R" },
{ placeholder: "B" },
{ placeholder: "L" },
]
$: settingsControls = !!panelDefinition ? Object.entries(panelDefinition) : []
</script>
<h4>Settings Panel</h4>
<InputGroup label="Testing" {meta} />
{#each settingsControls as [key, definition]}
<PropertyControl
control={definition.control}
label={key}
value={componentInstance[key]}
onChange={value => handleChange(key, value)}
props={{ ...excludeProps(definition, ['control']) }} />
{/each}

View File

@ -24,7 +24,7 @@ export const createProps = (componentDefinition, derivedFromProps) => {
const props = { const props = {
_id: uuid(), _id: uuid(),
_component: componentDefinition._component, _component: componentDefinition._component,
_styles: { position: {}, layout: {} }, _styles: {},
_code: "", _code: "",
} }
@ -71,7 +71,7 @@ export const makePropsSafe = (componentDefinition, props) => {
} }
if (!props._styles) { if (!props._styles) {
props._styles = { layout: {}, position: {} } props._styles = {}
} }
return props return props

View File

@ -1,16 +1,14 @@
import Input from "../common/Input.svelte" import Input from "../common/Input.svelte"
import OptionSelect from "./OptionSelect.svelte" import OptionSelect from "./OptionSelect.svelte"
import InputGroup from "../common/Inputs/InputGroup.svelte"
/* /*
TODO: Allow for default values for all properties TODO: Allow for default values for all properties
*/ */
export const general = { export const layout = [
text: { control: Input }, {
}
export const layout = {
flexDirection: {
label: "Direction", label: "Direction",
cssKey: "flex-direction",
control: OptionSelect, control: OptionSelect,
initialValue: "columnReverse", initialValue: "columnReverse",
options: [ options: [
@ -20,41 +18,45 @@ export const layout = {
{ label: "column-reverse", value: "columnReverse" }, { label: "column-reverse", value: "columnReverse" },
], ],
}, },
justifyContent: { label: "Justify", control: Input }, { label: "Justify", cssKey: "justify-content", control: Input },
alignItems: { label: "Align", control: Input }, { label: "Align", cssKey: "align-items", control: Input },
flexWrap: { {
label: "Wrap", label: "Wrap",
cssKey: "flex-wrap",
control: OptionSelect, control: OptionSelect,
options: [{ label: "wrap" }, { label: "no wrap", value: "noWrap" }], options: [{ label: "wrap" }, { label: "no wrap", value: "noWrap" }],
}, },
} ]
export const spacing = { const spacingMeta = [
padding: { control: Input }, { placeholder: "T" },
margin: { control: Input }, { placeholder: "R" },
} { placeholder: "B" },
{ placeholder: "L" },
]
export const spacing = [
{
label: "Padding",
cssKey: "padding",
control: InputGroup,
meta: spacingMeta,
},
{ label: "Margin", cssKey: "margin", control: InputGroup, meta: spacingMeta },
]
export const size = { export const size = [
width: { control: Input }, { label: "Width", cssKey: "width", control: Input },
height: { control: Input }, { label: "Height", cssKey: "height", control: Input },
minWidth: { label: "Min W", control: Input }, { label: "Min W", cssKey: "min-width", control: Input },
minHeight: { label: "Min H", control: Input }, { label: "Min H", cssKey: "min-height", control: Input },
maxWidth: { label: "Max W", control: Input }, { label: "Max W", cssKey: "max-width", control: Input },
maxHeight: { label: "Max H", control: Input }, { label: "Max H", cssKey: "max-height", control: Input },
overflow: { ]
control: OptionSelect,
options: [
{ label: "visible" },
{ label: "auto" },
{ label: "hidden" },
{ label: "auto" },
{ label: "scroll" },
],
}, //custom
}
export const position = { export const position = [
position: { {
label: "Position",
cssKey: "position",
control: OptionSelect, control: OptionSelect,
options: [ options: [
{ label: "static" }, { label: "static" },
@ -64,11 +66,12 @@ export const position = {
{ label: "sticky" }, { label: "sticky" },
], ],
}, },
} ]
export const typography = { export const typography = [
fontFamily: { {
label: "Font", label: "Font",
cssKey: "font-family",
control: OptionSelect, control: OptionSelect,
options: [ options: [
{ label: "initial" }, { label: "initial" },
@ -82,8 +85,9 @@ export const typography = {
], ],
styleBindingProperty: "font-family", styleBindingProperty: "font-family",
}, },
fontWeight: { {
label: "weight", label: "Weight",
cssKey: "font-weight",
control: OptionSelect, control: OptionSelect,
options: [ options: [
{ label: "normal" }, { label: "normal" },
@ -92,9 +96,11 @@ export const typography = {
{ label: "lighter" }, { label: "lighter" },
], ],
}, },
fontSize: { label: "size", control: Input }, { label: "size", cssKey: "font-size", control: Input },
lineHeight: { label: "Line H", control: Input }, { label: "Line H", cssKey: "line-height", control: Input },
color: { {
label: "Color",
cssKey: "color",
control: OptionSelect, control: OptionSelect,
options: [ options: [
{ label: "black" }, { label: "black" },
@ -104,8 +110,9 @@ export const typography = {
{ label: "green" }, { label: "green" },
], ],
}, },
textAlign: { {
label: "align", label: "align",
cssKey: "text-align",
control: OptionSelect, control: OptionSelect,
options: [ options: [
{ label: "initial" }, { label: "initial" },
@ -115,13 +122,14 @@ export const typography = {
{ label: "justify" }, { label: "justify" },
], ],
}, //custom }, //custom
textTransform: { label: "transform", control: Input }, //custom { label: "transform", cssKey: "text-transform", control: Input }, //custom
fontStyle: { label: "style", control: Input }, //custom { label: "style", cssKey: "font-style", control: Input }, //custom
} ]
export const background = { export const background = [
backgroundColor: { {
label: "Background Color", label: "Background",
cssKey: "background",
control: OptionSelect, control: OptionSelect,
options: [ options: [
{ label: "white" }, { label: "white" },
@ -131,30 +139,29 @@ export const background = {
{ label: "black" }, { label: "black" },
], ],
}, },
image: { control: Input }, //custom { label: "Image", cssKey: "image", control: Input }, //custom
} ]
export const border = { export const border = [
borderRadius: { label: "radius", control: Input }, { label: "Radius", cssKey: "border-radius", control: Input },
borderWidth: { label: "width", control: Input }, //custom { label: "Width", cssKey: "border-width", control: Input }, //custom
borderColor: { label: "color", control: Input }, { label: "Color", cssKey: "border-color", control: Input },
borderStyle: { label: "style", control: Input }, { label: "Style", cssKey: "border-style", control: Input },
} ]
export const effects = { export const effects = [
opacity: { control: Input }, { label: "Opacity", cssKey: "opacity", control: Input },
rotate: { control: Input }, { label: "Rotate", cssKey: "transform", control: Input }, //needs special control
shadow: { control: Input }, { label: "Shadow", cssKey: "box-shadow", control: Input },
} ]
export const transitions = { export const transitions = [
property: { control: Input }, { label: "Property", cssKey: "transition-property", control: Input },
duration: { control: Input }, { label: "Duration", cssKey: "transition-timing-function", control: Input },
ease: { control: Input }, { label: "Ease", cssKey: "transition-ease", control: Input },
} ]
export const all = { export const all = {
general,
layout, layout,
spacing, spacing,
size, size,
@ -174,4 +181,4 @@ export function excludeProps(props, propsToExclude) {
} }
} }
return modifiedProps return modifiedProps
} }

View File

@ -1,12 +1,6 @@
import { import Input from "../common/Input.svelte"
general,
layout, import { all } from "./propertyCategories.js"
typography,
border,
size,
background,
all,
} from "./propertyCategories.js"
export default { export default {
categories: [ categories: [
@ -30,7 +24,7 @@ export default {
icon: "ri-layout-row-fill", icon: "ri-layout-row-fill",
commonProps: {}, commonProps: {},
children: [], children: [],
properties: { background, size }, properties: { design: { ...all } },
}, },
{ {
name: "Text", name: "Text",
@ -44,17 +38,29 @@ export default {
description: "A component for displaying heading text", description: "A component for displaying heading text",
icon: "ri-heading", icon: "ri-heading",
properties: { properties: {
...all design: { ...all },
settings: {
text: {
control: Input,
},
},
}, },
}, },
{ {
_component: "@budibase/standard-components/text", _component: "@budibase/standard-components/text",
name: "Paragraph", name: "Paragraph",
description: "A component for displaying paragraph text.", description: "A component for displaying paragraph text.",
icon: 'ri-paragraph', icon: "ri-paragraph",
properties: { general, typography }, properties: {
} design: { ...all },
] settings: {
text: {
control: Input,
},
},
},
},
],
}, },
{ {
name: "Input", name: "Input",
@ -65,58 +71,60 @@ export default {
{ {
_component: "@budibase/standard-components/input", _component: "@budibase/standard-components/input",
name: "Textfield", name: "Textfield",
description: "A textfield component that allows the user to input text.", description:
icon: 'ri-edit-box-line', "A textfield component that allows the user to input text.",
properties: {} icon: "ri-edit-box-line",
properties: { design: { ...all } },
}, },
{ {
_component: "@budibase/standard-components/checkbox", _component: "@budibase/standard-components/checkbox",
name: "Checkbox", name: "Checkbox",
description: "A selectable checkbox component", description: "A selectable checkbox component",
icon: 'ri-checkbox-line', icon: "ri-checkbox-line",
properties: {} properties: { design: { ...all } },
}, },
{ {
_component: "@budibase/standard-components/radiobutton", _component: "@budibase/standard-components/radiobutton",
name: "Radiobutton", name: "Radiobutton",
description: "A selectable radiobutton component", description: "A selectable radiobutton component",
icon: 'ri-radio-button-line', icon: "ri-radio-button-line",
properties: {} properties: { design: { ...all } },
}, },
{ {
_component: "@budibase/standard-components/select", _component: "@budibase/standard-components/select",
name: "Select", name: "Select",
description: "A select component for choosing from different options", description:
icon: 'ri-file-list-line', "A select component for choosing from different options",
properties: {} icon: "ri-file-list-line",
} properties: { design: { ...all } },
] },
],
}, },
{ {
_component: "@budibase/standard-components/button", _component: "@budibase/standard-components/button",
name: 'Button', name: "Button",
description: 'A basic html button that is ready for styling', description: "A basic html button that is ready for styling",
icon: 'ri-radio-button-fill', icon: "ri-radio-button-fill",
children: [], children: [],
properties: { background, typography, border, size }, properties: { design: { ...all } },
}, },
{ {
_component: "@budibase/standard-components/icon", _component: "@budibase/standard-components/icon",
name: 'Icon', name: "Icon",
description: 'A basic component for displaying icons', description: "A basic component for displaying icons",
icon: 'ri-sun-fill', icon: "ri-sun-fill",
properties: {}, children: [],
children: [] properties: { design: { ...all } },
}, },
{ {
_component: "@budibase/standard-components/link", _component: "@budibase/standard-components/link",
name: 'Link', name: "Link",
description: 'A basic link component for internal and external links', description: "A basic link component for internal and external links",
icon: 'ri-link', icon: "ri-link",
properties: {}, children: [],
children: [] properties: { design: { ...all } },
} },
] ],
}, },
{ {
name: "Blocks", name: "Blocks",
@ -124,18 +132,20 @@ export default {
children: [ children: [
{ {
_component: "@budibase/materialdesign-components/BasicCard", _component: "@budibase/materialdesign-components/BasicCard",
name: 'Card', name: "Card",
description: 'A basic card component that can contain content and actions.', description:
icon: 'ri-layout-bottom-line', "A basic card component that can contain content and actions.",
icon: "ri-layout-bottom-line",
children: [], children: [],
properties: { size, background, border }, properties: { design: { ...all } },
}, },
{ {
name: 'Login', name: "Login",
description: 'A component that automatically generates a login screen for your app.', description:
icon: 'ri-login-box-fill', "A component that automatically generates a login screen for your app.",
properties: {}, icon: "ri-login-box-fill",
children: [] children: [],
properties: { design: { ...all } },
}, },
{ {
name: "Navigation Bar", name: "Navigation Bar",
@ -143,27 +153,27 @@ export default {
description: description:
"A component for handling the navigation within your app.", "A component for handling the navigation within your app.",
icon: "ri-navigation-fill", icon: "ri-navigation-fill",
properties: {}, children: [],
children: [] properties: { design: { ...all } },
} },
] ],
}, },
{ {
name: "Data", name: "Data",
isCategory: true, isCategory: true,
children: [ children: [
{ {
name: 'Table', name: "Table",
description: 'A component that generates a table from your data.', description: "A component that generates a table from your data.",
icon: 'ri-archive-drawer-fill', icon: "ri-archive-drawer-fill",
properties: {}, properties: { design: { ...all } },
children: [] children: [],
}, },
{ {
name: 'Form', name: "Form",
description: 'A component that generates a form from your data.', description: "A component that generates a form from your data.",
icon: 'ri-file-edit-fill', icon: "ri-file-edit-fill",
properties: {}, properties: { design: { ...all } },
_component: "@budibase/materialdesign-components/Form", _component: "@budibase/materialdesign-components/Form",
template: { template: {
component: "@budibase/materialdesign-components/Form", component: "@budibase/materialdesign-components/Form",
@ -177,7 +187,7 @@ export default {
name: "DataTable", name: "DataTable",
description: "A table for displaying data from the backend.", description: "A table for displaying data from the backend.",
icon: "ri-archive-drawer-fill", icon: "ri-archive-drawer-fill",
commonProps: {}, properties: { design: { ...all } },
children: [], children: [],
}, },
{ {
@ -185,7 +195,7 @@ export default {
name: "DataForm", name: "DataForm",
description: "Form stuff", description: "Form stuff",
icon: "ri-file-edit-fill", icon: "ri-file-edit-fill",
commonProps: {}, properties: { design: { ...all } },
children: [], children: [],
}, },
{ {
@ -193,7 +203,7 @@ export default {
_component: "@budibase/standard-components/datachart", _component: "@budibase/standard-components/datachart",
description: "Shiny chart", description: "Shiny chart",
icon: "ri-bar-chart-line", icon: "ri-bar-chart-line",
commonProps: {}, properties: { design: { ...all } },
children: [], children: [],
}, },
{ {
@ -201,7 +211,7 @@ export default {
_component: "@budibase/standard-components/datalist", _component: "@budibase/standard-components/datalist",
description: "Shiny list", description: "Shiny list",
icon: "ri-file-list-line", icon: "ri-file-list-line",
commonProps: {}, properties: { design: { ...all } },
children: [], children: [],
}, },
{ {
@ -209,10 +219,10 @@ export default {
_component: "@budibase/standard-components/datamap", _component: "@budibase/standard-components/datamap",
description: "Shiny map", description: "Shiny map",
icon: "ri-map-pin-line", icon: "ri-map-pin-line",
commonProps: {}, properties: { design: { ...all } },
children: [], children: [],
}, },
], ],
}, },
], ],
} }

View File

@ -31,7 +31,7 @@ export const attachChildren = initialiseOpts => (htmlElement, options) => {
} }
} }
htmlElement.classList.add(`lay-${treeNode.props._id}`) // htmlElement.classList.add(`lay-${treeNode.props._id}`)
const childNodes = [] const childNodes = []
for (let childProps of treeNode.props._children) { for (let childProps of treeNode.props._children) {

View File

@ -36,7 +36,7 @@ export const prepareRenderComponent = ({
htmlElement.children[htmlElement.children.length - 1] htmlElement.children[htmlElement.children.length - 1]
if (props._id && thisNode.rootElement) { if (props._id && thisNode.rootElement) {
thisNode.rootElement.classList.add(`pos-${props._id}`) thisNode.rootElement.classList.add(`element-${props._id}`)
} }
} }
} }