Fix component settings which have no labels appearing as undefined in the conditional UI drawer
This commit is contained in:
parent
3edb9a76d5
commit
8d79a23700
|
@ -163,7 +163,12 @@ export const getComponentSettings = componentType => {
|
||||||
def.settings
|
def.settings
|
||||||
?.filter(setting => setting.section)
|
?.filter(setting => setting.section)
|
||||||
.forEach(section => {
|
.forEach(section => {
|
||||||
settings = settings.concat(section.settings || [])
|
settings = settings.concat(
|
||||||
|
(section.settings || []).map(setting => ({
|
||||||
|
...setting,
|
||||||
|
section: section.name,
|
||||||
|
}))
|
||||||
|
)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
componentSettingCache[componentType] = settings
|
componentSettingCache[componentType] = settings
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
import { onDestroy } from "svelte"
|
import { onDestroy } from "svelte"
|
||||||
|
|
||||||
export let label = ""
|
export let label = ""
|
||||||
|
export let labelHidden = false
|
||||||
export let componentInstance = {}
|
export let componentInstance = {}
|
||||||
export let control = null
|
export let control = null
|
||||||
export let key = ""
|
export let key = ""
|
||||||
|
@ -75,7 +76,7 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="property-control" class:highlighted={highlighted && nullishValue}>
|
<div class="property-control" class:highlighted={highlighted && nullishValue}>
|
||||||
{#if type !== "boolean" && label}
|
{#if type !== "boolean" && label && !labelHidden}
|
||||||
<div class="label">
|
<div class="label">
|
||||||
<Label>{label}</Label>
|
<Label>{label}</Label>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -132,6 +132,7 @@
|
||||||
type={setting.type}
|
type={setting.type}
|
||||||
control={getComponentForSetting(setting)}
|
control={getComponentForSetting(setting)}
|
||||||
label={setting.label}
|
label={setting.label}
|
||||||
|
labelHidden={setting.labelHidden}
|
||||||
key={setting.key}
|
key={setting.key}
|
||||||
value={componentInstance[setting.key]}
|
value={componentInstance[setting.key]}
|
||||||
defaultValue={setting.defaultValue}
|
defaultValue={setting.defaultValue}
|
||||||
|
|
|
@ -62,7 +62,7 @@
|
||||||
type: "text",
|
type: "text",
|
||||||
})
|
})
|
||||||
$: settingOptions = settings.map(setting => ({
|
$: settingOptions = settings.map(setting => ({
|
||||||
label: setting.label,
|
label: makeLabel(setting),
|
||||||
value: setting.key,
|
value: setting.key,
|
||||||
}))
|
}))
|
||||||
$: conditions.forEach(link => {
|
$: conditions.forEach(link => {
|
||||||
|
@ -71,6 +71,18 @@
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const makeLabel = setting => {
|
||||||
|
if (setting.section) {
|
||||||
|
let label = setting.section
|
||||||
|
if (setting.label) {
|
||||||
|
return `${label} - ${setting.label}`
|
||||||
|
}
|
||||||
|
return label
|
||||||
|
} else {
|
||||||
|
return setting.label
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const getSettingDefinition = key => {
|
const getSettingDefinition = key => {
|
||||||
return settings.find(setting => setting.key === key)
|
return settings.find(setting => setting.key === key)
|
||||||
}
|
}
|
||||||
|
|
|
@ -4380,6 +4380,8 @@
|
||||||
"name": "On row click",
|
"name": "On row click",
|
||||||
"settings": [
|
"settings": [
|
||||||
{
|
{
|
||||||
|
"label": "Behaviour",
|
||||||
|
"labelHidden": true,
|
||||||
"type": "radio",
|
"type": "radio",
|
||||||
"key": "clickBehaviour",
|
"key": "clickBehaviour",
|
||||||
"sendEvents": true,
|
"sendEvents": true,
|
||||||
|
@ -4397,6 +4399,8 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"label": "Actions",
|
||||||
|
"labelHidden": true,
|
||||||
"type": "event",
|
"type": "event",
|
||||||
"key": "onClick",
|
"key": "onClick",
|
||||||
"nested": true,
|
"nested": true,
|
||||||
|
@ -4433,7 +4437,7 @@
|
||||||
{
|
{
|
||||||
"type": "radio",
|
"type": "radio",
|
||||||
"key": "titleButtonClickBehaviour",
|
"key": "titleButtonClickBehaviour",
|
||||||
"label": "On Click",
|
"label": "Behaviour",
|
||||||
"dependsOn": "showTitleButton",
|
"dependsOn": "showTitleButton",
|
||||||
"defaultValue": "actions",
|
"defaultValue": "actions",
|
||||||
"info": "New row side panel is only compatible with internal or SQL tables",
|
"info": "New row side panel is only compatible with internal or SQL tables",
|
||||||
|
@ -4450,6 +4454,8 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "event",
|
"type": "event",
|
||||||
|
"label": "On click",
|
||||||
|
"labelHidden": true,
|
||||||
"key": "onClickTitleButton",
|
"key": "onClickTitleButton",
|
||||||
"nested": true,
|
"nested": true,
|
||||||
"dependsOn": {
|
"dependsOn": {
|
||||||
|
|
Loading…
Reference in New Issue