fix disabled state interfering with column name input

This commit is contained in:
Peter Clement 2023-11-21 13:46:34 +00:00
parent 7ed273e158
commit 19f527d620
1 changed files with 15 additions and 5 deletions

View File

@ -149,7 +149,7 @@
}
const initialiseField = (field, savingColumn) => {
isCreating = !field
console.log("triggered")
if (field && !savingColumn) {
editableColumn = cloneDeep(field)
originalName = editableColumn.name ? editableColumn.name + "" : null
@ -171,7 +171,8 @@
relationshipPart2 = part2
}
}
} else if (!savingColumn) {
}
if (!field && !savingColumn) {
let highestNumber = 0
Object.keys(table.schema).forEach(columnName => {
const columnNumber = extractColumnNumber(columnName)
@ -182,9 +183,9 @@
})
if (highestNumber >= 1) {
editableColumn.name = `Column 0${highestNumber + 1}`
//editableColumn.name = `Column 0${highestNumber + 1}`
} else {
editableColumn.name = "Column 01"
//editableColumn.name = "Column 01"
}
}
@ -535,13 +536,22 @@
onMount(() => {
mounted = true
})
$: console.log(editableColumn)
</script>
<Layout noPadding gap="S">
{#if mounted}
<Input
value={editableColumn.name}
autofocus
bind:value={editableColumn.name}
on:input={e => {
if (
!uneditable &&
!(linkEditDisabled && editableColumn.type === LINK_TYPE)
) {
editableColumn.name = e.target.value
}
}}
disabled={uneditable ||
(linkEditDisabled && editableColumn.type === LINK_TYPE)}
error={errors?.name}