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";
|
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-12-03 14:04:08 +01:00
|
|
|
function onChange(evt: Event) {
|
|
|
|
const oldIdx = parseInt((evt.target as HTMLSelectElement).value, 10);
|
|
|
|
state.setOldIndex(ctx, newIndex, oldIdx);
|
|
|
|
}
|
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-03 14:04:08 +01:00
|
|
|
<select
|
|
|
|
value={$info.getOldIndex(ctx, newIndex)}
|
|
|
|
class="form-select"
|
|
|
|
on:change={onChange}
|
|
|
|
>
|
|
|
|
{#each $info.getOldNamesIncludingNothing(ctx) as name, idx}
|
|
|
|
<option value={idx}>{name}</option>
|
2021-06-10 13:30:39 +02:00
|
|
|
{/each}
|
2022-12-03 14:04:08 +01: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>
|