2023-08-18 17:23:56 -04:00
|
|
|
<script>
|
|
|
|
import FILTERS from "./filters.json";
|
|
|
|
import { filters } from "./stores.js";
|
|
|
|
|
|
|
|
export let filter = {
|
|
|
|
name: "",
|
|
|
|
params: [],
|
|
|
|
description: "",
|
|
|
|
};
|
|
|
|
|
2023-08-18 18:59:16 -04:00
|
|
|
export let index;
|
2023-08-18 17:23:56 -04:00
|
|
|
|
2023-08-18 18:59:16 -04:00
|
|
|
function remove() {
|
|
|
|
$filters.splice(index, 1);
|
|
|
|
$filters = $filters;
|
2023-08-18 17:23:56 -04:00
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<div class="filter-holder">
|
|
|
|
<div class="head">
|
2023-08-18 18:59:16 -04:00
|
|
|
<div class="name">{filter.name}</div>
|
2023-08-18 17:23:56 -04:00
|
|
|
<button on:click={remove}>X</button>
|
|
|
|
</div>
|
|
|
|
|
2023-08-18 18:59:16 -04:00
|
|
|
<div class="description">{filter.description}</div>
|
2023-08-18 17:23:56 -04:00
|
|
|
|
2023-08-18 18:59:16 -04:00
|
|
|
{#if filter.params.length > 0}
|
|
|
|
<div class="options">
|
|
|
|
{#each filter.params as p}
|
|
|
|
<div class="param-holder">
|
|
|
|
<div class="param">
|
|
|
|
<span class="p-name">{p.name}</span>
|
|
|
|
<span class="p-value">
|
|
|
|
{#if p.options && p.options.length > 0}
|
|
|
|
<select bind:value={p.value}>
|
|
|
|
{#each p.options as o}
|
|
|
|
<option value={o.value}
|
|
|
|
>{o.value}
|
|
|
|
{#if o.desc}({o.desc}){/if}
|
|
|
|
</option>
|
|
|
|
{/each}
|
|
|
|
</select>
|
|
|
|
{:else if p.type == "float" || p.type == "double" || p.type == "long" || p.type == "int"}
|
|
|
|
<input type="range" min={p.min} max={p.max} bind:value={p.value} />
|
|
|
|
<input bind:value={p.value} />
|
|
|
|
{:else}
|
|
|
|
<input bind:value={p.value} />
|
|
|
|
{/if}
|
|
|
|
</span>
|
2023-08-18 17:23:56 -04:00
|
|
|
</div>
|
2023-08-18 18:59:16 -04:00
|
|
|
<div class="p-description">{p.desc}</div>
|
|
|
|
</div>
|
|
|
|
{/each}
|
|
|
|
</div>
|
2023-08-18 17:23:56 -04:00
|
|
|
{/if}
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
.filter-holder {
|
|
|
|
background-color: #fff;
|
|
|
|
padding: 10px;
|
|
|
|
}
|
|
|
|
.filter-holder,
|
|
|
|
input,
|
|
|
|
select {
|
|
|
|
font-size: 14px;
|
|
|
|
font-family: "Times New Roman", Times, serif;
|
|
|
|
}
|
|
|
|
.description {
|
|
|
|
margin: 10px 0px;
|
|
|
|
}
|
|
|
|
.head {
|
|
|
|
display: flex;
|
|
|
|
justify-content: space-between;
|
|
|
|
}
|
|
|
|
.options {
|
|
|
|
/* margin-top: 10px; */
|
|
|
|
/* padding-top: 10px; */
|
|
|
|
}
|
|
|
|
.param {
|
|
|
|
margin-bottom: 5px;
|
|
|
|
display: flex;
|
|
|
|
justify-content: space-between;
|
|
|
|
}
|
|
|
|
.param-holder {
|
|
|
|
border-top: 1px solid #999;
|
|
|
|
padding: 10px 0px;
|
|
|
|
}
|
2023-08-18 18:59:16 -04:00
|
|
|
.param-holder:last-child {
|
|
|
|
padding-bottom: 0;
|
|
|
|
}
|
2023-08-18 17:23:56 -04:00
|
|
|
.p-description {
|
2023-08-18 18:59:16 -04:00
|
|
|
opacity: 0.8;
|
2023-08-18 17:23:56 -04:00
|
|
|
font-size: 0.9em;
|
|
|
|
}
|
|
|
|
|
|
|
|
p {
|
|
|
|
margin: 0;
|
|
|
|
}
|
|
|
|
</style>
|