2020-01-22 13:00:20 +01:00
|
|
|
<script>
|
2020-02-03 10:50:30 +01:00
|
|
|
import InputGroup from "../common/Inputs/InputGroup.svelte"
|
2020-03-27 17:58:32 +01:00
|
|
|
import LayoutTemplateControls from "./LayoutTemplateControls.svelte"
|
2020-01-22 13:00:20 +01:00
|
|
|
|
2020-02-03 10:50:30 +01:00
|
|
|
export let onStyleChanged = () => {}
|
2020-02-10 16:51:09 +01:00
|
|
|
export let component
|
2020-01-22 13:00:20 +01:00
|
|
|
|
|
|
|
const tbrl = [
|
2020-02-03 10:50:30 +01:00
|
|
|
{ placeholder: "T" },
|
|
|
|
{ placeholder: "R" },
|
|
|
|
{ placeholder: "B" },
|
|
|
|
{ placeholder: "L" },
|
2020-01-22 13:00:20 +01:00
|
|
|
]
|
|
|
|
|
2020-02-03 10:50:30 +01:00
|
|
|
const se = [{ placeholder: "START" }, { placeholder: "END" }]
|
2020-01-28 22:17:04 +01:00
|
|
|
|
2020-02-03 10:50:30 +01:00
|
|
|
const single = [{ placeholder: "" }]
|
2020-01-28 22:17:04 +01:00
|
|
|
|
2020-02-03 10:50:30 +01:00
|
|
|
$: layout = {
|
2020-02-10 16:51:09 +01:00
|
|
|
...component._styles.position,
|
|
|
|
...component._styles.layout,
|
2020-02-03 10:50:30 +01:00
|
|
|
}
|
2020-01-31 17:01:58 +01:00
|
|
|
|
|
|
|
$: layouts = {
|
2020-02-03 10:50:30 +01:00
|
|
|
templaterows: ["Grid Rows", single],
|
|
|
|
templatecolumns: ["Grid Columns", single],
|
|
|
|
}
|
2020-01-28 22:17:04 +01:00
|
|
|
|
2020-03-06 18:00:54 +01:00
|
|
|
$: display = {
|
|
|
|
direction: ["Direction", single],
|
|
|
|
align: ["Align", single],
|
|
|
|
justify: ["Justify", single],
|
|
|
|
}
|
|
|
|
|
2020-01-28 22:17:04 +01:00
|
|
|
$: positions = {
|
2020-02-03 10:50:30 +01:00
|
|
|
column: ["Column", se],
|
|
|
|
row: ["Row", se],
|
|
|
|
}
|
2020-01-28 22:17:04 +01:00
|
|
|
|
|
|
|
$: spacing = {
|
2020-02-03 10:50:30 +01:00
|
|
|
margin: ["Margin", tbrl, "small"],
|
|
|
|
padding: ["Padding", tbrl, "small"],
|
|
|
|
}
|
2020-01-28 22:17:04 +01:00
|
|
|
|
2020-02-20 18:07:25 +01:00
|
|
|
$: size = {
|
|
|
|
height: ["Height", single],
|
|
|
|
width: ["Width", single],
|
|
|
|
}
|
|
|
|
|
2020-01-28 22:17:04 +01:00
|
|
|
$: zindex = {
|
2020-02-03 10:50:30 +01:00
|
|
|
zindex: ["Z-Index", single],
|
2020-01-28 22:17:04 +01:00
|
|
|
}
|
|
|
|
|
2020-02-03 10:50:30 +01:00
|
|
|
const newValue = n => Array(n).fill("")
|
2020-01-22 13:00:20 +01:00
|
|
|
</script>
|
2020-01-22 12:21:42 +01:00
|
|
|
|
2020-03-24 12:12:08 +01:00
|
|
|
<h3>Layout</h3>
|
2020-01-31 17:01:58 +01:00
|
|
|
<div class="layout-pos">
|
2020-03-06 18:00:54 +01:00
|
|
|
{#each Object.entries(display) as [key, [name, meta, size]] (component._id + key)}
|
2020-01-31 17:01:58 +01:00
|
|
|
<div class="grid">
|
|
|
|
<h5>{name}:</h5>
|
2020-03-27 17:58:32 +01:00
|
|
|
<LayoutTemplateControls
|
|
|
|
onStyleChanged={_value => onStyleChanged('layout', key, _value)}
|
|
|
|
values={layout[key] || newValue(meta.length)}
|
|
|
|
propertyName={name}
|
|
|
|
{meta}
|
|
|
|
{size}
|
|
|
|
type="text" />
|
2020-01-31 17:01:58 +01:00
|
|
|
</div>
|
|
|
|
{/each}
|
|
|
|
</div>
|
2020-01-22 12:21:42 +01:00
|
|
|
|
2020-03-06 18:00:54 +01:00
|
|
|
<!-- <h4>Positioning</h4>
|
2020-01-22 12:21:42 +01:00
|
|
|
<div class="layout-pos">
|
2020-02-10 16:51:09 +01:00
|
|
|
{#each Object.entries(positions) as [key, [name, meta, size]] (component._id + key)}
|
2020-01-28 22:17:04 +01:00
|
|
|
<div class="grid">
|
2020-01-31 17:01:58 +01:00
|
|
|
<h5>{name}:</h5>
|
2020-02-03 10:50:30 +01:00
|
|
|
<InputGroup
|
|
|
|
onStyleChanged={_value => onStyleChanged('position', key, _value)}
|
|
|
|
values={layout[key] || newValue(meta.length)}
|
|
|
|
{meta}
|
|
|
|
{size} />
|
2020-01-28 22:17:04 +01:00
|
|
|
</div>
|
|
|
|
{/each}
|
2020-03-06 18:00:54 +01:00
|
|
|
</div> -->
|
2020-01-22 12:21:42 +01:00
|
|
|
|
2020-03-24 12:12:08 +01:00
|
|
|
<h3>Spacing</h3>
|
2020-01-22 12:21:42 +01:00
|
|
|
<div class="layout-spacing">
|
2020-02-10 16:51:09 +01:00
|
|
|
{#each Object.entries(spacing) as [key, [name, meta, size]] (component._id + key)}
|
2020-01-28 22:17:04 +01:00
|
|
|
<div class="grid">
|
2020-01-31 17:01:58 +01:00
|
|
|
<h5>{name}:</h5>
|
2020-02-03 10:50:30 +01:00
|
|
|
<InputGroup
|
|
|
|
onStyleChanged={_value => onStyleChanged('position', key, _value)}
|
|
|
|
values={layout[key] || newValue(meta.length)}
|
|
|
|
{meta}
|
2020-02-20 18:07:25 +01:00
|
|
|
{size}
|
|
|
|
type="text" />
|
|
|
|
</div>
|
|
|
|
{/each}
|
|
|
|
</div>
|
|
|
|
|
2020-03-24 12:12:08 +01:00
|
|
|
<h3>Size</h3>
|
2020-02-20 18:07:25 +01:00
|
|
|
<div class="layout-layer">
|
|
|
|
{#each Object.entries(size) as [key, [name, meta, size]] (component._id + key)}
|
|
|
|
<div class="grid">
|
|
|
|
<h5>{name}:</h5>
|
|
|
|
<InputGroup
|
|
|
|
onStyleChanged={_value => onStyleChanged('position', key, _value)}
|
|
|
|
values={layout[key] || newValue(meta.length)}
|
|
|
|
type="text"
|
|
|
|
{meta}
|
2020-02-03 10:50:30 +01:00
|
|
|
{size} />
|
2020-01-28 22:17:04 +01:00
|
|
|
</div>
|
|
|
|
{/each}
|
2020-01-22 12:21:42 +01:00
|
|
|
</div>
|
|
|
|
|
2020-03-24 12:12:08 +01:00
|
|
|
<h3>Order</h3>
|
2020-01-22 12:21:42 +01:00
|
|
|
<div class="layout-layer">
|
2020-02-10 16:51:09 +01:00
|
|
|
{#each Object.entries(zindex) as [key, [name, meta, size]] (component._id + key)}
|
2020-01-28 22:17:04 +01:00
|
|
|
<div class="grid">
|
2020-01-31 17:01:58 +01:00
|
|
|
<h5>{name}:</h5>
|
2020-02-03 10:50:30 +01:00
|
|
|
<InputGroup
|
|
|
|
onStyleChanged={_value => onStyleChanged('position', key, _value)}
|
|
|
|
values={layout[key] || newValue(meta.length)}
|
|
|
|
{meta}
|
|
|
|
{size} />
|
2020-01-28 22:17:04 +01:00
|
|
|
</div>
|
|
|
|
{/each}
|
2020-01-22 12:21:42 +01:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
h3 {
|
|
|
|
text-transform: uppercase;
|
2020-04-02 18:11:38 +02:00
|
|
|
font-size: 13px;
|
2020-01-22 12:21:42 +01:00
|
|
|
font-weight: 700;
|
2020-03-24 11:56:48 +01:00
|
|
|
color: #000333;
|
|
|
|
opacity: 0.6;
|
2020-01-22 12:21:42 +01:00
|
|
|
margin-bottom: 10px;
|
|
|
|
}
|
|
|
|
|
|
|
|
h4 {
|
|
|
|
text-transform: uppercase;
|
|
|
|
font-size: 10px;
|
2020-03-24 12:12:08 +01:00
|
|
|
font-weight: 600;
|
2020-03-24 11:56:48 +01:00
|
|
|
color: #000333;
|
|
|
|
opacity: 0.4;
|
2020-03-24 12:12:08 +01:00
|
|
|
letter-spacing: 1px;
|
2020-03-27 17:58:01 +01:00
|
|
|
margin-bottom: 10px;
|
2020-01-22 12:21:42 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
h5 {
|
2020-04-02 18:11:38 +02:00
|
|
|
font-size: 13px;
|
2020-03-24 11:56:48 +01:00
|
|
|
font-weight: 400;
|
|
|
|
color: #000333;
|
|
|
|
opacity: 0.8;
|
2020-04-02 18:11:38 +02:00
|
|
|
padding-top: 13px;
|
2020-01-22 13:00:20 +01:00
|
|
|
margin-bottom: 0;
|
2020-01-22 12:21:42 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
div > div {
|
|
|
|
display: grid;
|
|
|
|
grid-template-rows: 1fr;
|
|
|
|
grid-gap: 10px;
|
|
|
|
height: 40px;
|
|
|
|
margin-bottom: 15px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.grid {
|
2020-03-24 12:12:08 +01:00
|
|
|
grid-template-columns: 70px 2fr;
|
2020-01-22 12:21:42 +01:00
|
|
|
}
|
|
|
|
</style>
|