diff --git a/packages/builder/package.json b/packages/builder/package.json index bf4c4b4a89..fdcb9ae4a1 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -63,7 +63,7 @@ } }, "dependencies": { - "@budibase/bbui": "^1.58.12", + "@budibase/bbui": "^1.58.13", "@budibase/client": "^0.7.8", "@budibase/colorpicker": "1.0.1", "@budibase/string-templates": "^0.7.8", diff --git a/packages/builder/src/builderStore/dataBinding.js b/packages/builder/src/builderStore/dataBinding.js index 858bfa8801..429ba1c683 100644 --- a/packages/builder/src/builderStore/dataBinding.js +++ b/packages/builder/src/builderStore/dataBinding.js @@ -232,6 +232,15 @@ export const getSchemaForDatasource = (datasource, isForm = false) => { if (table) { if (type === "view") { schema = cloneDeep(table.views?.[datasource.name]?.schema) + + // Some calc views don't include a "name" property inside the schema + if (schema) { + Object.keys(schema).forEach(field => { + if (!schema[field].name) { + schema[field].name = field + } + }) + } } else if (type === "query" && isForm) { schema = {} const params = table.parameters || [] diff --git a/packages/builder/src/components/backend/DataTable/RowFieldControl.svelte b/packages/builder/src/components/backend/DataTable/RowFieldControl.svelte index 3390b95288..075b556134 100644 --- a/packages/builder/src/components/backend/DataTable/RowFieldControl.svelte +++ b/packages/builder/src/components/backend/DataTable/RowFieldControl.svelte @@ -11,8 +11,9 @@ import { capitalise } from "../../../helpers" import LinkedRowSelector from "components/common/LinkedRowSelector.svelte" + export let defaultValue export let meta - export let value = meta.type === "boolean" ? false : "" + export let value = defaultValue || (meta.type === "boolean" ? false : "") export let readonly $: type = meta.type diff --git a/packages/builder/src/components/backend/DataTable/modals/CreateEditColumn.svelte b/packages/builder/src/components/backend/DataTable/modals/CreateEditColumn.svelte index 1e3f820d69..ae19489575 100644 --- a/packages/builder/src/components/backend/DataTable/modals/CreateEditColumn.svelte +++ b/packages/builder/src/components/backend/DataTable/modals/CreateEditColumn.svelte @@ -7,7 +7,6 @@ Select, Toggle, Radio, - } from "@budibase/bbui" import { cloneDeep } from "lodash/fp" import { backendUiStore } from "builderStore" @@ -38,12 +37,14 @@ $backendUiStore.selectedTable.primaryDisplay === field.name let relationshipTypes = [ - {text: 'Many to many (N:N)', value: 'many-to-many',}, - {text: 'One to many (1:N)', value: 'one-to-many',} + { text: "Many to many (N:N)", value: "many-to-many" }, + { text: "One to many (1:N)", value: "one-to-many" }, ] - let types = ['Many to many (N:N)', 'One to many (1:N)'] + let types = ["Many to many (N:N)", "One to many (1:N)"] - let selectedRelationshipType = relationshipTypes.find(type => type.value === field.relationshipType)?.text || 'Many to many (N:N)' + let selectedRelationshipType = + relationshipTypes.find(type => type.value === field.relationshipType) + ?.text || "Many to many (N:N)" let indexes = [...($backendUiStore.selectedTable.indexes || [])] let confirmDeleteDialog @@ -68,10 +69,12 @@ field.type !== LINK_TYPE && !uneditable && field.type !== AUTO_COL async function saveColumn() { - // Set relationship type if it's - if (field.type === 'link') { - field.relationshipType = relationshipTypes.find(type => type.text === selectedRelationshipType).value - } + // Set relationship type if it's + if (field.type === "link") { + field.relationshipType = relationshipTypes.find( + type => type.text === selectedRelationshipType + ).value + } if (field.type === AUTO_COL) { field = buildAutoColumn( @@ -228,11 +231,15 @@ label="Max Value" bind:value={field.constraints.numericality.lessThanOrEqualTo} /> {:else if field.type === 'link'} -