mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
- 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.
35 lines
1.2 KiB
Svelte
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>
|