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