1
0
Fork 0
mirror of synced 2024-07-04 14:01:27 +12:00

Fix button groups not working in design panel

This commit is contained in:
Andrew Kingston 2021-01-26 09:04:29 +00:00
parent 12fa20de8d
commit 580d5b6478

View file

@ -9,12 +9,17 @@
export let onStyleChanged = () => {} export let onStyleChanged = () => {}
export let open = false export let open = false
$: style = componentInstance["_styles"][styleCategory] || {}
$: changed = properties.some(prop => hasPropChanged(style, prop))
const hasPropChanged = (style, prop) => { const hasPropChanged = (style, prop) => {
return style[prop.key] != null && style[prop.key] !== "" return style[prop.key] != null && style[prop.key] !== ""
} }
$: style = componentInstance["_styles"][styleCategory] || {} const getControlProps = props => {
$: changed = properties.some(prop => hasPropChanged(style, prop)) const { label, key, control, ...otherProps } = props || {}
return otherProps || {}
}
</script> </script>
<DetailSummary name={`${name}${changed ? ' *' : ''}`} on:open show={open} thin> <DetailSummary name={`${name}${changed ? ' *' : ''}`} on:open show={open} thin>
@ -28,7 +33,7 @@
key={prop.key} key={prop.key}
value={style[prop.key]} value={style[prop.key]}
onChange={value => onStyleChanged(styleCategory, prop.key, value)} onChange={value => onStyleChanged(styleCategory, prop.key, value)}
props={{ options: prop.options, placeholder: prop.placeholder }} /> props={getControlProps(prop)} />
{/each} {/each}
</div> </div>
{/if} {/if}