Renamings
This commit is contained in:
parent
321bd8eec4
commit
2c715f5144
|
@ -35,6 +35,7 @@
|
||||||
import JSONSchemaModal from "./JSONSchemaModal.svelte"
|
import JSONSchemaModal from "./JSONSchemaModal.svelte"
|
||||||
import { ValidColumnNameRegex } from "@budibase/shared-core"
|
import { ValidColumnNameRegex } from "@budibase/shared-core"
|
||||||
import { admin } from "stores/portal"
|
import { admin } from "stores/portal"
|
||||||
|
import { FieldType } from "@budibase/types"
|
||||||
|
|
||||||
const AUTO_TYPE = "auto"
|
const AUTO_TYPE = "auto"
|
||||||
const FORMULA_TYPE = FIELDS.FORMULA.type
|
const FORMULA_TYPE = FIELDS.FORMULA.type
|
||||||
|
@ -71,7 +72,7 @@
|
||||||
fieldName: $tables.selected.name,
|
fieldName: $tables.selected.name,
|
||||||
}
|
}
|
||||||
|
|
||||||
const typeMapping = {}
|
const bbRefTypeMapping = {}
|
||||||
if (!$admin.isDev) {
|
if (!$admin.isDev) {
|
||||||
delete fieldDefinitions.USER
|
delete fieldDefinitions.USER
|
||||||
}
|
}
|
||||||
|
@ -79,13 +80,13 @@
|
||||||
// Handling fields with subtypes
|
// Handling fields with subtypes
|
||||||
fieldDefinitions = Object.entries(fieldDefinitions).reduce(
|
fieldDefinitions = Object.entries(fieldDefinitions).reduce(
|
||||||
(p, [key, field]) => {
|
(p, [key, field]) => {
|
||||||
if (field.subtype) {
|
if (field.type === FieldType.BB_REFERENCE) {
|
||||||
const composedType = `${field.type}_${field.subtype}`
|
const composedType = `${field.type}_${field.subtype}`
|
||||||
p[key] = {
|
p[key] = {
|
||||||
...field,
|
...field,
|
||||||
type: composedType,
|
type: composedType,
|
||||||
}
|
}
|
||||||
typeMapping[composedType] = {
|
bbRefTypeMapping[composedType] = {
|
||||||
type: field.type,
|
type: field.type,
|
||||||
subtype: field.subtype,
|
subtype: field.subtype,
|
||||||
}
|
}
|
||||||
|
@ -112,7 +113,7 @@
|
||||||
$tables.selected.primaryDisplay == null ||
|
$tables.selected.primaryDisplay == null ||
|
||||||
$tables.selected.primaryDisplay === editableColumn.name
|
$tables.selected.primaryDisplay === editableColumn.name
|
||||||
|
|
||||||
const mapped = Object.entries(typeMapping).find(
|
const mapped = Object.entries(bbRefTypeMapping).find(
|
||||||
([_, v]) => v.type === field.type && v.subtype === field.subtype
|
([_, v]) => v.type === field.type && v.subtype === field.subtype
|
||||||
)
|
)
|
||||||
if (mapped) {
|
if (mapped) {
|
||||||
|
@ -217,8 +218,11 @@
|
||||||
|
|
||||||
let saveColumn = cloneDeep(editableColumn)
|
let saveColumn = cloneDeep(editableColumn)
|
||||||
|
|
||||||
if (typeMapping[saveColumn.type]) {
|
if (bbRefTypeMapping[saveColumn.type]) {
|
||||||
saveColumn = { ...saveColumn, ...typeMapping[saveColumn.type] }
|
saveColumn = {
|
||||||
|
...saveColumn,
|
||||||
|
...bbRefTypeMapping[saveColumn.type],
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (saveColumn.type === AUTO_TYPE) {
|
if (saveColumn.type === AUTO_TYPE) {
|
||||||
|
|
Loading…
Reference in New Issue