1
0
Fork 0
mirror of synced 2024-09-14 00:08:25 +12:00

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

View file

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