fix duplicate column name issue

This commit is contained in:
Martin McKeaveney 2021-03-15 20:38:55 +00:00
parent c4b828416a
commit 3dd902666c
2 changed files with 24 additions and 16 deletions

View File

@ -53,7 +53,11 @@
$: uneditable = $: uneditable =
$backendUiStore.selectedTable?._id === TableNames.USERS && $backendUiStore.selectedTable?._id === TableNames.USERS &&
UNEDITABLE_USER_FIELDS.includes(field.name) UNEDITABLE_USER_FIELDS.includes(field.name)
$: invalid = field.type === LINK_TYPE && !field.tableId $: invalid =
(field.type === LINK_TYPE && !field.tableId) ||
Object.keys($backendUiStore.draftTable.schema).some(
key => key === field.name
)
// used to select what different options can be displayed for column type // used to select what different options can be displayed for column type
$: canBeSearched = $: canBeSearched =

View File

@ -1,38 +1,42 @@
<script> <script>
import { createEventDispatcher } from 'svelte' import { createEventDispatcher } from "svelte"
import Colorpicker from "@budibase/colorpicker" import Colorpicker from "@budibase/colorpicker"
const dispatch = createEventDispatcher(); const dispatch = createEventDispatcher()
export let value export let value
const WAIT = 150; const WAIT = 150
function throttle(callback, wait, immediate = false) { function throttle(callback, wait, immediate = false) {
let timeout = null let timeout = null
let initialCall = true let initialCall = true
return function() { return function() {
const callNow = immediate && initialCall const callNow = immediate && initialCall
const next = () => { const next = () => {
callback.apply(this, arguments) callback.apply(this, arguments)
timeout = null timeout = null
} }
if (callNow) { if (callNow) {
initialCall = false initialCall = false
next() next()
} }
if (!timeout) { if (!timeout) {
timeout = setTimeout(next, wait) timeout = setTimeout(next, wait)
} }
} }
} }
const onChange = throttle(e => { const onChange = throttle(
dispatch('change', e.detail) e => {
}, WAIT, true) dispatch("change", e.detail)
},
WAIT,
true
)
</script> </script>
<Colorpicker value={value || '#C4C4C4'} on:change={onChange} /> <Colorpicker value={value || '#C4C4C4'} on:change={onChange} />