mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
Merge pull request #2361 from appwrite/fix-dat-745
This commit is contained in:
+8
-7
@@ -26,23 +26,24 @@
|
||||
let formStore = writable(formValues);
|
||||
|
||||
function removeArrayItem(key: string, index: number) {
|
||||
const currentArray = Array.isArray($formStore[key]) ? $formStore[key] : [];
|
||||
const filteredArray = currentArray.filter((_: object, i: number) => i !== index);
|
||||
const next = {
|
||||
...$formStore,
|
||||
[key]: $formStore[key].filter((_, i) => i !== index)
|
||||
...formValues,
|
||||
[key]: filteredArray.length === 0 ? [] : filteredArray
|
||||
};
|
||||
|
||||
formStore.set(next);
|
||||
onUpdateFormValues?.(next);
|
||||
}
|
||||
|
||||
function addArrayItem(key: string) {
|
||||
const currentArray = Array.isArray($formStore[key]) ? $formStore[key] : null;
|
||||
const next = {
|
||||
...$formStore,
|
||||
[key]: [...($formStore[key] ?? []), null]
|
||||
...formValues,
|
||||
[key]: currentArray ? [...currentArray, null] : [null]
|
||||
};
|
||||
|
||||
formStore.set(next);
|
||||
onUpdateFormValues?.(next);
|
||||
}
|
||||
|
||||
function getColumnType(column: Columns) {
|
||||
@@ -107,7 +108,7 @@
|
||||
on:click />
|
||||
{:else}
|
||||
<Layout.Stack>
|
||||
{#each [...($formStore[column.key]?.keys() ?? [])] as index}
|
||||
{#each [...($formStore[column.key]?.keys() ?? [])] as index (index)}
|
||||
<Layout.Stack direction="row" alignItems="flex-end" gap="xs">
|
||||
<Column
|
||||
{column}
|
||||
|
||||
+8
@@ -1,6 +1,8 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from 'svelte';
|
||||
import type { Models } from '@appwrite.io/console';
|
||||
import { InputDateTime } from '$lib/elements/forms';
|
||||
import { toLocalDateTimeISO } from '$lib/helpers/date';
|
||||
import { IconCalendar } from '@appwrite.io/pink-icons-svelte';
|
||||
|
||||
export let id: string;
|
||||
@@ -15,6 +17,12 @@
|
||||
$: if (limited) {
|
||||
label = undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* the value from backend will include timezone info,
|
||||
* and that's not compatible with the component as it'll go empty.
|
||||
*/
|
||||
onMount(() => (value = value ? toLocalDateTimeISO(value) : value));
|
||||
</script>
|
||||
|
||||
<InputDateTime
|
||||
|
||||
Reference in New Issue
Block a user