From fa84b3fbc2a15917a2deea197779baa64ca65b07 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Wed, 13 Mar 2024 15:16:21 +0100 Subject: [PATCH 1/8] Magic strings to enums --- .../DataTable/modals/CreateEditColumn.svelte | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/builder/src/components/backend/DataTable/modals/CreateEditColumn.svelte b/packages/builder/src/components/backend/DataTable/modals/CreateEditColumn.svelte index 1bad1ee221..c866f45e46 100644 --- a/packages/builder/src/components/backend/DataTable/modals/CreateEditColumn.svelte +++ b/packages/builder/src/components/backend/DataTable/modals/CreateEditColumn.svelte @@ -479,7 +479,7 @@ newError.name = `Column name already in use.` } - if (fieldInfo.type === "auto" && !fieldInfo.subtype) { + if (fieldInfo.type === FieldType.AUTO && !fieldInfo.subtype) { newError.subtype = `Auto Column requires a type` } @@ -540,18 +540,18 @@ }} /> - {#if editableColumn.type === "string"} + {#if editableColumn.type === FieldType.STRING} - {:else if editableColumn.type === "options"} + {:else if editableColumn.type === FieldType.OPTIONS} - {:else if editableColumn.type === "longform"} + {:else if editableColumn.type === FieldType.LONGFORM}
@@ -569,12 +569,12 @@ text="Enable rich text support (markdown)" />
- {:else if editableColumn.type === "array"} + {:else if editableColumn.type === FieldType.ARRAY} - {:else if editableColumn.type === "datetime" && !editableColumn.autocolumn} + {:else if editableColumn.type === FieldType.DATETIME && !editableColumn.autocolumn}
@@ -613,7 +613,7 @@
{/if} - {:else if editableColumn.type === "number" && !editableColumn.autocolumn} + {:else if editableColumn.type === FieldType.NUMBER && !editableColumn.autocolumn}
@@ -638,7 +638,7 @@ />
- {:else if editableColumn.type === "link"} + {:else if editableColumn.type === FieldType.LINK} Date: Wed, 13 Mar 2024 15:46:22 +0100 Subject: [PATCH 2/8] Multiple attachments flags --- .../DataTable/modals/CreateEditColumn.svelte | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/packages/builder/src/components/backend/DataTable/modals/CreateEditColumn.svelte b/packages/builder/src/components/backend/DataTable/modals/CreateEditColumn.svelte index c866f45e46..0aeaa105de 100644 --- a/packages/builder/src/components/backend/DataTable/modals/CreateEditColumn.svelte +++ b/packages/builder/src/components/backend/DataTable/modals/CreateEditColumn.svelte @@ -170,6 +170,10 @@ relationshipPart1 = part1 relationshipPart2 = part2 } + } else if (editableColumn.type === FieldType.ATTACHMENT) { + editableColumn.constraints ??= { length: {} } + editableColumn.constraints.length ??= {} + editableColumn.constraints.length.maximum = 1 } } @@ -710,6 +714,21 @@ thin text="Allow multiple users" /> + {:else if editableColumn.type === FieldType.ATTACHMENT} + { + if (!e.detail) { + editableColumn.constraints ??= { length: {} } + editableColumn.constraints.length ??= {} + editableColumn.constraints.length.maximum = 1 + } else { + delete editableColumn.constraints?.length?.maximum + } + }} + thin + text="Multiple attachments" + /> {/if} {#if editableColumn.type === AUTO_TYPE || editableColumn.autocolumn}