Fix Import Validations

This commit is contained in:
Gerard Burns 2023-02-06 13:10:22 +00:00 committed by Martin McKeaveney
parent d76c3407a3
commit e2f52c8e1d
1 changed files with 7 additions and 2 deletions

View File

@ -94,6 +94,11 @@
validateHash = newValidateHash
}
const handleChange = (name, e) => {
schema[name].type = e.detail
schema[name].constraints = FIELDS[e.detail.toUpperCase()].constraints
}
</script>
<div class="dropzone">
@ -118,12 +123,12 @@
</div>
{#if rows.length > 0 && !error}
<div class="schema-fields">
{#each Object.values(schema) as column}
{#each Object.entries(schema) as [name, column]}
<div class="field">
<span>{column.name}</span>
<Select
bind:value={column.type}
on:change={e => (column.type = e.detail)}
on:change={e => handleChange(name, e)}
options={typeOptions}
placeholder={null}
getOptionLabel={option => option.label}