2021-04-12 06:18:30 +02:00
|
|
|
<!--
|
|
|
|
Copyright: Ankitects Pty Ltd and contributors
|
|
|
|
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|
|
|
-->
|
|
|
|
<script lang="ts">
|
|
|
|
import RevertIcon from "./RevertIcon.svelte";
|
2021-04-22 07:39:50 +02:00
|
|
|
import HelpPopup from "./HelpPopup.svelte";
|
2021-04-12 06:18:30 +02:00
|
|
|
|
|
|
|
export let label: string;
|
|
|
|
export let subLabel = "";
|
|
|
|
export let value: any;
|
|
|
|
export let defaultValue: any;
|
2021-04-17 14:53:47 +02:00
|
|
|
/// empty strings will be ignored
|
|
|
|
export let warnings: string[] = [];
|
2021-04-22 08:47:10 +02:00
|
|
|
export let wholeLine = false;
|
2021-04-12 06:18:30 +02:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
.outer {
|
|
|
|
margin-top: 1em;
|
2021-04-22 07:39:50 +02:00
|
|
|
display: grid;
|
2021-04-22 08:47:10 +02:00
|
|
|
grid-template-columns: 2fr 1fr;
|
2021-04-22 07:39:50 +02:00
|
|
|
grid-column-gap: 0.5em;
|
2021-04-12 06:18:30 +02:00
|
|
|
}
|
|
|
|
|
2021-04-22 07:39:50 +02:00
|
|
|
.full-grid-width {
|
|
|
|
grid-column: 1 / 3;
|
|
|
|
}
|
|
|
|
|
|
|
|
.table {
|
|
|
|
display: table;
|
|
|
|
height: 100%;
|
|
|
|
}
|
|
|
|
|
|
|
|
.vcenter {
|
|
|
|
display: table-cell;
|
|
|
|
vertical-align: middle;
|
|
|
|
}
|
|
|
|
|
|
|
|
.alert {
|
|
|
|
margin-top: 0.5em;
|
|
|
|
}
|
|
|
|
|
|
|
|
.input-grid {
|
|
|
|
display: grid;
|
|
|
|
grid-column-gap: 0.5em;
|
2021-04-22 08:47:10 +02:00
|
|
|
grid-template-columns: 10fr 16px;
|
2021-04-12 06:18:30 +02:00
|
|
|
}
|
|
|
|
</style>
|
|
|
|
|
|
|
|
<div class="outer">
|
2021-04-22 08:47:10 +02:00
|
|
|
{#if label}
|
|
|
|
<div class="table">
|
|
|
|
<span class="vcenter">
|
|
|
|
{label}
|
|
|
|
{#if subLabel}
|
|
|
|
<HelpPopup html={subLabel} />
|
|
|
|
{/if}
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
{/if}
|
2021-04-12 06:18:30 +02:00
|
|
|
|
2021-04-22 08:47:10 +02:00
|
|
|
<div class="input-grid" class:full-grid-width={wholeLine}>
|
2021-04-12 06:18:30 +02:00
|
|
|
<slot />
|
2021-04-22 07:39:50 +02:00
|
|
|
<RevertIcon bind:value {defaultValue} on:revert />
|
2021-04-12 06:18:30 +02:00
|
|
|
</div>
|
2021-04-17 14:53:47 +02:00
|
|
|
|
2021-04-22 07:39:50 +02:00
|
|
|
<div class="full-grid-width">
|
|
|
|
{#each warnings as warning}
|
|
|
|
{#if warning}
|
|
|
|
<div class="alert alert-warning">{warning}</div>
|
|
|
|
{/if}
|
|
|
|
{/each}
|
|
|
|
</div>
|
2021-04-12 06:18:30 +02:00
|
|
|
</div>
|