Pre demo changes
This commit is contained in:
parent
2b3ce7b34d
commit
2e6a0e36c0
|
@ -29,7 +29,7 @@
|
||||||
let selectedCategory = categories[0]
|
let selectedCategory = categories[0]
|
||||||
|
|
||||||
$: components = $store.components
|
$: components = $store.components
|
||||||
$: componentInstance = $store.currentComponentInfo //contains prop values of currently selected component
|
$: componentInstance = $store.currentComponentInfo
|
||||||
$: componentDefinition = $store.components.find(
|
$: componentDefinition = $store.components.find(
|
||||||
c => c.name === componentInstance._component
|
c => c.name === componentInstance._component
|
||||||
)
|
)
|
||||||
|
@ -39,8 +39,7 @@
|
||||||
c => c._component === componentInstance._component
|
c => c._component === componentInstance._component
|
||||||
)
|
)
|
||||||
|
|
||||||
// OLD PROPS =============================================
|
// SCREEN PROPS =============================================
|
||||||
|
|
||||||
$: screen_props =
|
$: screen_props =
|
||||||
$store.currentFrontEndType === "page"
|
$store.currentFrontEndType === "page"
|
||||||
? getProps($store.currentPreviewItem, ["name", "favicon"])
|
? getProps($store.currentPreviewItem, ["name", "favicon"])
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<script>
|
<script>
|
||||||
import { excludeProps } from "./propertyCategories.js"
|
import { excludeProps } from "./propertyCategories.js"
|
||||||
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 = {}
|
||||||
|
@ -8,6 +9,7 @@
|
||||||
export let onPropChanged = () => {}
|
export let onPropChanged = () => {}
|
||||||
|
|
||||||
export let show = false
|
export let show = false
|
||||||
|
let showComponentGroup = false
|
||||||
|
|
||||||
const propExistsOnComponentDef = prop => prop in componentDefinition.props
|
const propExistsOnComponentDef = prop => prop in componentDefinition.props
|
||||||
const capitalize = name => name[0].toUpperCase() + name.slice(1)
|
const capitalize = name => name[0].toUpperCase() + name.slice(1)
|
||||||
|
@ -16,10 +18,22 @@
|
||||||
!!v.target ? onPropChanged(key, v.target.value) : onPropChanged(key, v)
|
!!v.target ? onPropChanged(key, v.target.value) : onPropChanged(key, v)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$: {
|
||||||
|
let res = false
|
||||||
|
let componentProps = Object.keys(componentDefinition.props)
|
||||||
|
for (let prop in properties) {
|
||||||
|
if (componentProps.includes(prop)) {
|
||||||
|
showComponentGroup = true
|
||||||
|
}
|
||||||
|
if (showComponentGroup) break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$: propertyDefinition = Object.entries(properties)
|
$: 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>
|
||||||
|
|
||||||
|
<!-- {#if showComponentGroup} -->
|
||||||
<div class="property-group-container">
|
<div class="property-group-container">
|
||||||
<div class="property-group-name" on:click={() => (show = !show)}>
|
<div class="property-group-name" on:click={() => (show = !show)}>
|
||||||
<div class="icon">
|
<div class="icon">
|
||||||
|
@ -41,6 +55,7 @@
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<!-- {/if} -->
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.property-group-container {
|
.property-group-container {
|
||||||
|
|
|
@ -96,7 +96,13 @@ export const typography = {
|
||||||
lineHeight: { label: "Line H", control: Input },
|
lineHeight: { label: "Line H", control: Input },
|
||||||
color: {
|
color: {
|
||||||
control: OptionSelect,
|
control: OptionSelect,
|
||||||
options: [{ label: "red" }, { label: "blue" }, { label: "green" }],
|
options: [
|
||||||
|
{ label: "black" },
|
||||||
|
{ label: "red" },
|
||||||
|
{ label: "white" },
|
||||||
|
{ label: "blue" },
|
||||||
|
{ label: "green" },
|
||||||
|
],
|
||||||
},
|
},
|
||||||
textAlign: {
|
textAlign: {
|
||||||
label: "align",
|
label: "align",
|
||||||
|
@ -114,7 +120,17 @@ export const typography = {
|
||||||
}
|
}
|
||||||
|
|
||||||
export const background = {
|
export const background = {
|
||||||
backgroundColor: { label: "Background Color", control: Input },
|
backgroundColor: {
|
||||||
|
label: "Background Color",
|
||||||
|
control: OptionSelect,
|
||||||
|
options: [
|
||||||
|
{ label: "white" },
|
||||||
|
{ label: "red" },
|
||||||
|
{ label: "blue" },
|
||||||
|
{ label: "green" },
|
||||||
|
{ label: "black" },
|
||||||
|
],
|
||||||
|
},
|
||||||
image: { control: Input }, //custom
|
image: { control: Input }, //custom
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,12 @@
|
||||||
import { general, layout, typography, background, all } from "./propertyCategories.js"
|
import {
|
||||||
|
general,
|
||||||
|
layout,
|
||||||
|
typography,
|
||||||
|
border,
|
||||||
|
size,
|
||||||
|
background,
|
||||||
|
all,
|
||||||
|
} from "./propertyCategories.js"
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
categories: [
|
categories: [
|
||||||
|
@ -13,7 +21,7 @@ export default {
|
||||||
icon: 'ri-layout-row-fill',
|
icon: 'ri-layout-row-fill',
|
||||||
commonProps: {},
|
commonProps: {},
|
||||||
children: [],
|
children: [],
|
||||||
properties: { ...all },
|
properties: { background, size },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Text',
|
name: 'Text',
|
||||||
|
@ -27,9 +35,7 @@ export default {
|
||||||
description: "A component for displaying heading text",
|
description: "A component for displaying heading text",
|
||||||
icon: "ri-heading",
|
icon: "ri-heading",
|
||||||
properties: {
|
properties: {
|
||||||
general,
|
...all
|
||||||
layout,
|
|
||||||
typography,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -37,7 +43,7 @@ export default {
|
||||||
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: {}
|
properties: { general, typography },
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -83,7 +89,7 @@ export default {
|
||||||
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: {},
|
properties: { background, typography, border, size },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
_component: "@budibase/standard-components/icon",
|
_component: "@budibase/standard-components/icon",
|
||||||
|
@ -112,8 +118,8 @@ export default {
|
||||||
name: 'Card',
|
name: 'Card',
|
||||||
description: 'A basic card component that can contain content and actions.',
|
description: 'A basic card component that can contain content and actions.',
|
||||||
icon: 'ri-layout-bottom-line',
|
icon: 'ri-layout-bottom-line',
|
||||||
properties: {},
|
children: [],
|
||||||
children: []
|
properties: { size, background, border },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Login',
|
name: 'Login',
|
||||||
|
|
|
@ -326,6 +326,8 @@
|
||||||
},
|
},
|
||||||
"backgroundColor": "string",
|
"backgroundColor": "string",
|
||||||
"color": "string",
|
"color": "string",
|
||||||
|
"height": "string",
|
||||||
|
"width": "string",
|
||||||
"borderWidth": "string",
|
"borderWidth": "string",
|
||||||
"borderColor": "string",
|
"borderColor": "string",
|
||||||
"borderStyle": {
|
"borderStyle": {
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
import { buildStyle } from "./buildStyle"
|
import { buildStyle } from "./buildStyle"
|
||||||
export let className = "default"
|
export let className = "default"
|
||||||
export let disabled = false
|
export let disabled = false
|
||||||
export let contentText
|
export let text
|
||||||
export let onClick
|
export let onClick
|
||||||
export let background
|
export let background
|
||||||
export let color
|
export let color
|
||||||
|
@ -66,9 +66,7 @@
|
||||||
disabled={disabled || false}
|
disabled={disabled || false}
|
||||||
on:click={clickHandler}
|
on:click={clickHandler}
|
||||||
style={buttonStyles}>
|
style={buttonStyles}>
|
||||||
{#if !_bb.props._children || _bb.props._children.length === 0}
|
{#if !_bb.props._children || _bb.props._children.length === 0}{text}{/if}
|
||||||
{contentText}
|
|
||||||
{/if}
|
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|
|
@ -6,6 +6,8 @@
|
||||||
export let type = "div"
|
export let type = "div"
|
||||||
export let backgroundColor
|
export let backgroundColor
|
||||||
export let color
|
export let color
|
||||||
|
export let width
|
||||||
|
export let height
|
||||||
export let borderWidth
|
export let borderWidth
|
||||||
export let borderColor
|
export let borderColor
|
||||||
export let borderStyle
|
export let borderStyle
|
||||||
|
@ -18,6 +20,8 @@
|
||||||
$: cssVariables = {
|
$: cssVariables = {
|
||||||
backgroundColor,
|
backgroundColor,
|
||||||
color,
|
color,
|
||||||
|
height,
|
||||||
|
width,
|
||||||
borderWidth,
|
borderWidth,
|
||||||
borderColor,
|
borderColor,
|
||||||
borderStyle,
|
borderStyle,
|
||||||
|
@ -108,6 +112,14 @@
|
||||||
color: var(--color);
|
color: var(--color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.height {
|
||||||
|
height: var(--height);
|
||||||
|
}
|
||||||
|
|
||||||
|
.width {
|
||||||
|
width: var(--width);
|
||||||
|
}
|
||||||
|
|
||||||
.borderColor {
|
.borderColor {
|
||||||
border-color: var(--borderColor);
|
border-color: var(--borderColor);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue