Merge pull request #1891 from Budibase/legacy-styles-compat
Legacy styles compatibility
This commit is contained in:
commit
993383c540
|
@ -284,7 +284,7 @@ export const background = {
|
||||||
|
|
||||||
export const border = {
|
export const border = {
|
||||||
label: "Border",
|
label: "Border",
|
||||||
columns: "auto 1fr",
|
columns: "1fr 1fr",
|
||||||
settings: [
|
settings: [
|
||||||
{
|
{
|
||||||
label: "Color",
|
label: "Color",
|
||||||
|
@ -295,17 +295,31 @@ export const border = {
|
||||||
label: "Width",
|
label: "Width",
|
||||||
key: "border-width",
|
key: "border-width",
|
||||||
control: Select,
|
control: Select,
|
||||||
|
column: "1 / 2",
|
||||||
|
placeholder: "None",
|
||||||
options: [
|
options: [
|
||||||
{ label: "Small", value: "1px" },
|
{ label: "Small", value: "1px" },
|
||||||
{ label: "Medium", value: "2px" },
|
{ label: "Medium", value: "2px" },
|
||||||
{ label: "Large", value: "4px" },
|
{ label: "Large", value: "4px" },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: "Style",
|
||||||
|
key: "border-style",
|
||||||
|
control: Select,
|
||||||
|
column: "2 / 3",
|
||||||
|
placeholder: "None",
|
||||||
|
options: [
|
||||||
|
{ label: "Solid", value: "solid" },
|
||||||
|
{ label: "Dotted", value: "dotted" },
|
||||||
|
{ label: "Dashed", value: "dashed" },
|
||||||
|
],
|
||||||
|
},
|
||||||
{
|
{
|
||||||
label: "Radius",
|
label: "Radius",
|
||||||
key: "border-radius",
|
key: "border-radius",
|
||||||
control: Select,
|
control: Select,
|
||||||
column: "1 / 3",
|
placeholder: "None",
|
||||||
options: [
|
options: [
|
||||||
{ label: "Small", value: "0.25rem" },
|
{ label: "Small", value: "0.25rem" },
|
||||||
{ label: "Medium", value: "0.5rem" },
|
{ label: "Medium", value: "0.5rem" },
|
||||||
|
@ -317,7 +331,7 @@ export const border = {
|
||||||
label: "Shadow",
|
label: "Shadow",
|
||||||
key: "box-shadow",
|
key: "box-shadow",
|
||||||
control: Select,
|
control: Select,
|
||||||
column: "1 / 3",
|
placeholder: "None",
|
||||||
options: [
|
options: [
|
||||||
{
|
{
|
||||||
label: "Small",
|
label: "Small",
|
||||||
|
|
|
@ -34,11 +34,6 @@ export const styleable = (node, styles = {}) => {
|
||||||
baseStyles.overflow = "hidden"
|
baseStyles.overflow = "hidden"
|
||||||
}
|
}
|
||||||
|
|
||||||
// Append border-style css if border-width is specified
|
|
||||||
if (newStyles.normal?.["border-width"]) {
|
|
||||||
baseStyles["border-style"] = "solid"
|
|
||||||
}
|
|
||||||
|
|
||||||
const componentId = newStyles.id
|
const componentId = newStyles.id
|
||||||
const customStyles = newStyles.custom || ""
|
const customStyles = newStyles.custom || ""
|
||||||
const normalStyles = { ...baseStyles, ...newStyles.normal }
|
const normalStyles = { ...baseStyles, ...newStyles.normal }
|
||||||
|
|
|
@ -19,12 +19,19 @@
|
||||||
|
|
||||||
// Add color styles to main styles object, otherwise the styleable helper
|
// Add color styles to main styles object, otherwise the styleable helper
|
||||||
// overrides the color when it's passed as inline style.
|
// overrides the color when it's passed as inline style.
|
||||||
$: styles = {
|
$: styles = enrichStyles($component.styles, color)
|
||||||
...$component.styles,
|
|
||||||
normal: {
|
const enrichStyles = (styles, color) => {
|
||||||
...$component.styles?.normal,
|
if (!color) {
|
||||||
color,
|
return styles
|
||||||
},
|
}
|
||||||
|
return {
|
||||||
|
...styles,
|
||||||
|
normal: {
|
||||||
|
...styles?.normal,
|
||||||
|
color,
|
||||||
|
},
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -23,12 +23,21 @@
|
||||||
|
|
||||||
// Add color styles to main styles object, otherwise the styleable helper
|
// Add color styles to main styles object, otherwise the styleable helper
|
||||||
// overrides the color when it's passed as inline style.
|
// overrides the color when it's passed as inline style.
|
||||||
$: styles = {
|
// Add color styles to main styles object, otherwise the styleable helper
|
||||||
...$component.styles,
|
// overrides the color when it's passed as inline style.
|
||||||
normal: {
|
$: styles = enrichStyles($component.styles, color)
|
||||||
...$component.styles?.normal,
|
|
||||||
color,
|
const enrichStyles = (styles, color) => {
|
||||||
},
|
if (!color) {
|
||||||
|
return styles
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
...styles,
|
||||||
|
normal: {
|
||||||
|
...styles?.normal,
|
||||||
|
color,
|
||||||
|
},
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -19,12 +19,19 @@
|
||||||
|
|
||||||
// Add color styles to main styles object, otherwise the styleable helper
|
// Add color styles to main styles object, otherwise the styleable helper
|
||||||
// overrides the color when it's passed as inline style.
|
// overrides the color when it's passed as inline style.
|
||||||
$: styles = {
|
$: styles = enrichStyles($component.styles, color)
|
||||||
...$component.styles,
|
|
||||||
normal: {
|
const enrichStyles = (styles, color) => {
|
||||||
...$component.styles?.normal,
|
if (!color) {
|
||||||
color,
|
return styles
|
||||||
},
|
}
|
||||||
|
return {
|
||||||
|
...styles,
|
||||||
|
normal: {
|
||||||
|
...styles?.normal,
|
||||||
|
color,
|
||||||
|
},
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue