From 9f22ab0a1a30e9d119994df0e19794b9574c8864 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Fri, 16 Apr 2021 13:47:30 +0100 Subject: [PATCH] Some fixes for creation/editing of table columns. --- .../DataTable/modals/CreateEditColumn.svelte | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/packages/builder/src/components/backend/DataTable/modals/CreateEditColumn.svelte b/packages/builder/src/components/backend/DataTable/modals/CreateEditColumn.svelte index d269124219..6de84eadde 100644 --- a/packages/builder/src/components/backend/DataTable/modals/CreateEditColumn.svelte +++ b/packages/builder/src/components/backend/DataTable/modals/CreateEditColumn.svelte @@ -51,12 +51,14 @@ ) $: required = !!field?.constraints?.presence || primaryDisplay $: uneditable = - $backendUiStore.selectedTable?._id === TableNames.USERS && - UNEDITABLE_USER_FIELDS.includes(field.name) + ($backendUiStore.selectedTable?._id === TableNames.USERS && + UNEDITABLE_USER_FIELDS.includes(field.name)) || + (originalName && field.type === LINK_TYPE) + $: invalid = (field.type === LINK_TYPE && !field.tableId) || Object.keys($backendUiStore.draftTable.schema).some( - key => key === field.name + key => key === field.name && key !== originalName ) // used to select what different options can be displayed for column type @@ -162,19 +164,22 @@ if (!linkTable) { return null } - const thisName = truncate(table.name, { length: 15 }), - linkName = truncate(linkTable.name, { length: 15 }) + const thisName = truncate(table.name, { length: 14 }), + linkName = truncate(linkTable.name, { length: 14 }) return [ { name: `Many ${thisName} rows → many ${linkName} rows`, + alt: `Many ${table.name} rows → many ${linkTable.name} rows`, value: RelationshipTypes.MANY_TO_MANY, }, { name: `One ${linkName} row → many ${thisName} rows`, + alt: `One ${linkTable.name} rows → many ${table.name} rows`, value: RelationshipTypes.ONE_TO_MANY, }, { name: `One ${thisName} row → many ${linkName} rows`, + alt: `One ${table.name} rows → many ${linkTable.name} rows`, value: RelationshipTypes.MANY_TO_ONE, }, ] @@ -267,13 +272,13 @@
- {#each relationshipOptions as { value, name }} + {#each relationshipOptions as { value, name, alt }} -
+