Merge pull request #13035 from Budibase/fix-formula-crash

Use constants for icon info rather than component definitions
This commit is contained in:
Andrew Kingston 2024-02-19 14:54:55 +00:00 committed by GitHub
commit 4fa28324cf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 13 additions and 10 deletions

View File

@ -1,15 +1,25 @@
<script>
import EditComponentPopover from "../EditComponentPopover.svelte"
import { FieldTypeToComponentMap } from "../FieldConfiguration/utils"
import { Toggle, Icon } from "@budibase/bbui"
import { createEventDispatcher } from "svelte"
import { cloneDeep } from "lodash/fp"
import { componentStore } from "stores/builder"
import { FIELDS } from "constants/backend"
export let item
export let anchor
const dispatch = createEventDispatcher()
$: fieldIconLookupMap = buildFieldIconLookupMap(FIELDS)
const buildFieldIconLookupMap = fields => {
let map = {}
Object.values(fields).forEach(fieldInfo => {
map[fieldInfo.type] = fieldInfo.icon
})
return map
}
const onToggle = item => {
return e => {
item.active = e.detail
@ -24,13 +34,6 @@
return { ...setting, nested: true }
})
}
const getIcon = () => {
const component = `@budibase/standard-components/${
FieldTypeToComponentMap[item.columnType]
}`
return componentStore.getDefinition(component).icon
}
</script>
<div class="list-item-body">
@ -42,7 +45,7 @@
on:change
>
<div slot="header" class="type-icon">
<Icon name={getIcon()} />
<Icon name={fieldIconLookupMap[item.columnType]} />
<span>{item.field}</span>
</div>
</EditComponentPopover>