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-12-07 06:31:37 +01: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;
|
2022-12-07 06:31:37 +01:00
|
|
|
$: oldIndex = $info.getOldIndex(ctx, newIndex);
|
2021-06-10 13:30:39 +02:00
|
|
|
|
2022-12-07 06:31:37 +01:00
|
|
|
function onChange(evt: CustomEvent) {
|
|
|
|
oldIndex = evt.detail.value;
|
|
|
|
state.setOldIndex(ctx, newIndex, oldIndex);
|
2022-12-03 14:04:08 +01:00
|
|
|
}
|
2022-12-07 06:31:37 +01:00
|
|
|
|
|
|
|
$: label = $info.getOldNamesIncludingNothing(ctx)[oldIndex];
|
2021-06-10 13:30:39 +02:00
|
|
|
</script>
|
|
|
|
|
2022-12-07 06:31:37 +01:00
|
|
|
<Row>
|
|
|
|
<Col>
|
|
|
|
<Select value={oldIndex} {label} on:change={onChange}>
|
2022-12-03 14:04:08 +01:00
|
|
|
{#each $info.getOldNamesIncludingNothing(ctx) as name, idx}
|
2022-12-07 06:31:37 +01:00
|
|
|
<SelectOption value={idx}>{name}</SelectOption>
|
2021-06-10 13:30:39 +02:00
|
|
|
{/each}
|
2022-12-07 06:31:37 +01:00
|
|
|
</Select>
|
2021-11-17 04:49:52 +01:00
|
|
|
</Col>
|
2022-12-07 06:31:37 +01:00
|
|
|
<Col>
|
2021-06-10 13:30:39 +02:00
|
|
|
{$info.getNewName(ctx, newIndex)}
|
2021-11-17 04:49:52 +01:00
|
|
|
</Col>
|
|
|
|
</Row>
|