2020-05-04 17:07:04 +02:00
|
|
|
<script>
|
|
|
|
import PropertyGroup from "./PropertyGroup.svelte"
|
2020-05-07 15:30:04 +02:00
|
|
|
import FlatButtonGroup from "./FlatButtonGroup.svelte"
|
2020-05-05 11:02:10 +02:00
|
|
|
|
2020-05-04 17:07:04 +02:00
|
|
|
export let panelDefinition = {}
|
|
|
|
export let componentInstance = {}
|
|
|
|
export let componentDefinition = {}
|
2020-05-18 17:32:00 +02:00
|
|
|
export let onStyleChanged = () => {}
|
2020-05-05 15:45:52 +02:00
|
|
|
|
2020-05-22 16:30:29 +02:00
|
|
|
let selectedCategory = "normal"
|
2020-05-07 15:30:04 +02:00
|
|
|
|
2020-05-18 17:32:00 +02:00
|
|
|
const getProperties = name => panelDefinition[name]
|
2020-05-04 17:07:04 +02:00
|
|
|
|
2020-05-07 15:30:04 +02:00
|
|
|
function onChange(category) {
|
|
|
|
selectedCategory = category
|
|
|
|
}
|
|
|
|
|
|
|
|
const buttonProps = [
|
2020-05-22 16:30:29 +02:00
|
|
|
{ value: "normal", text: "Normal" },
|
2020-05-07 15:30:04 +02:00
|
|
|
{ value: "hover", text: "Hover" },
|
|
|
|
{ value: "active", text: "Active" },
|
|
|
|
]
|
|
|
|
|
2020-05-18 17:32:00 +02:00
|
|
|
$: propertyGroupNames = Object.keys(panelDefinition)
|
2020-05-04 17:07:04 +02:00
|
|
|
</script>
|
|
|
|
|
2020-05-07 15:30:04 +02:00
|
|
|
<div class="design-view-container">
|
|
|
|
|
|
|
|
<div class="design-view-state-categories">
|
|
|
|
<FlatButtonGroup value={selectedCategory} {buttonProps} {onChange} />
|
|
|
|
</div>
|
|
|
|
|
2020-06-17 17:46:03 +02:00
|
|
|
<div class="positioned-wrapper">
|
2020-05-07 15:30:04 +02:00
|
|
|
<div class="design-view-property-groups">
|
2020-05-20 12:55:25 +02:00
|
|
|
{#if propertyGroupNames.length > 0}
|
|
|
|
{#each propertyGroupNames as groupName}
|
|
|
|
<PropertyGroup
|
|
|
|
name={groupName}
|
|
|
|
properties={getProperties(groupName)}
|
2020-05-22 16:30:29 +02:00
|
|
|
styleCategory={selectedCategory}
|
2020-05-20 12:55:25 +02:00
|
|
|
{onStyleChanged}
|
|
|
|
{componentDefinition}
|
|
|
|
{componentInstance} />
|
|
|
|
{/each}
|
|
|
|
{:else}
|
|
|
|
<div class="no-design">
|
|
|
|
<span>This component does not have any design properties</span>
|
|
|
|
</div>
|
|
|
|
{/if}
|
2020-05-07 15:30:04 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
2020-06-17 17:46:03 +02:00
|
|
|
</div>
|
2020-05-07 15:30:04 +02:00
|
|
|
|
|
|
|
<style>
|
|
|
|
.design-view-container {
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
width: 100%;
|
2020-05-28 17:24:53 +02:00
|
|
|
height: 100%;
|
2020-05-07 15:30:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
.design-view-state-categories {
|
|
|
|
flex: 0 0 50px;
|
|
|
|
}
|
|
|
|
|
2020-06-17 17:46:03 +02:00
|
|
|
.positioned-wrapper{
|
|
|
|
position: relative;
|
|
|
|
display: flex;
|
|
|
|
min-height: 0;
|
|
|
|
}
|
|
|
|
|
2020-05-07 15:30:04 +02:00
|
|
|
.design-view-property-groups {
|
|
|
|
flex: 1;
|
2020-06-01 18:14:54 +02:00
|
|
|
overflow-y: auto;
|
2020-06-02 13:47:40 +02:00
|
|
|
min-height: 0;
|
2020-05-07 15:30:04 +02:00
|
|
|
}
|
2020-05-20 12:55:25 +02:00
|
|
|
|
|
|
|
.no-design {
|
|
|
|
text-align: center;
|
|
|
|
}
|
2020-05-07 15:30:04 +02:00
|
|
|
</style>
|