Files
console/src/lib/elements/forms/inputLine.svelte
T
ArnabChatterjee20k fe7ea4113b Add InputPolygon component and enhance spatial input handling
- Introduced InputPolygon component for polygon spatial data input.
- Updated InputLine and InputPoint components to support index-based point addition and deletion.
- Modified line and point components to handle default spatial data more effectively.
- Enhanced column components to manage spatial data types including polygon.
2025-09-06 14:58:32 +05:30

35 lines
1.2 KiB
Svelte

<script lang="ts">
import { Icon, Layout } from '@appwrite.io/pink-svelte';
import InputPoint from './inputPoint.svelte';
import Button from './button.svelte';
import { IconPlus } from '@appwrite.io/pink-icons-svelte';
export let values: number[][];
export let nullable: boolean;
export let disableDeletePointsCountPerLine: number = 2;
export let onAddPoint: (index: number) => void;
export let onDeletePoint: (index: number) => void = undefined;
let required = true;
$: required = nullable;
let disableDeletePoints = false;
$: disableDeletePoints = !values || values.length <= disableDeletePointsCountPerLine;
</script>
<Layout.Stack alignItems="flex-start">
<Layout.Stack>
{#each values as value, index}
<InputPoint
nullable={required}
values={value}
deletePoints={true}
disableDelete={disableDeletePoints}
onDeletePoint={() => onDeletePoint(index)} />
{/each}
</Layout.Stack>
<Button compact on:click={() => onAddPoint(-1)} disabled={nullable}>
<Icon icon={IconPlus} size="s" /> Add coordinate
</Button>
</Layout.Stack>