2021-06-10 13:30:39 +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">
|
2021-11-17 04:49:52 +01:00
|
|
|
import Col from "../components/Col.svelte";
|
2022-02-04 09:36:34 +01:00
|
|
|
import Row from "../components/Row.svelte";
|
2022-09-27 04:16:45 +02:00
|
|
|
import Select from "../components/Select.svelte";
|
|
|
|
import SelectOption from "../components/SelectOption.svelte";
|
2021-06-10 13:30:39 +02:00
|
|
|
import type { ChangeNotetypeState, MapContext } from "./lib";
|
|
|
|
|
|
|
|
export let state: ChangeNotetypeState;
|
|
|
|
export let ctx: MapContext;
|
|
|
|
export let newIndex: number;
|
|
|
|
|
2022-02-04 09:36:34 +01:00
|
|
|
const info = state.info;
|
2021-06-10 13:30:39 +02:00
|
|
|
|
2022-09-27 04:16:45 +02:00
|
|
|
let oldIndex = $info.getOldIndex(ctx, newIndex);
|
|
|
|
|
|
|
|
const options = $info.getOldNamesIncludingNothing(ctx);
|
|
|
|
$: state.setOldIndex(ctx, newIndex, oldIndex);
|
2022-12-01 10:24:26 +01:00
|
|
|
$: label = options[oldIndex];
|
2021-06-10 13:30:39 +02:00
|
|
|
</script>
|
|
|
|
|
2021-11-17 04:49:52 +01:00
|
|
|
<Row --cols={2}>
|
|
|
|
<Col --col-size={1}>
|
2022-12-01 10:24:26 +01:00
|
|
|
<Select bind:value={oldIndex} {label}>
|
2022-09-27 04:16:45 +02:00
|
|
|
{#each options as name, idx}
|
2022-12-01 10:24:26 +01:00
|
|
|
<SelectOption value={idx}>{name}</SelectOption>
|
2021-06-10 13:30:39 +02:00
|
|
|
{/each}
|
2022-09-27 04:16:45 +02:00
|
|
|
</Select>
|
2021-11-17 04:49:52 +01:00
|
|
|
</Col>
|
|
|
|
<Col --col-size={1}>
|
2021-06-10 13:30:39 +02:00
|
|
|
{$info.getNewName(ctx, newIndex)}
|
2021-11-17 04:49:52 +01:00
|
|
|
</Col>
|
|
|
|
</Row>
|